MyBB Community Forums

Full Version: Change usergroup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can i make it so that I can change user group via my website. Like lets say a person vists www.site.com/page.php. When they visit that page, their usergroup changes from Member to like Page Visitor. How can I do that? Thanks.
i was looking at the dev files in the wiki and im thinking i should use the $db->update_query function. how would i use that?
Assuming you've included the MyBB core on page.php, then you can use something like this:
$update_user = array('usergroup' => 10);
$db->update_query("users", $update_user, "uid='{$mybb->user['uid']}'";

This will change the current user's usergroup to 10
How about changing just the User Title?

Would that be the following?

$update_user = array('usertitle' => "title here");
$db->update_query("users", $update_user, "uid='{$mybb->user['uid']}'");