MyBB Community Forums

Full Version: Change groupid on user login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Im running a mybb 1.8.6 and would like to know how i can change the group id of users from 0 to 2 when a user logs in to my website. The reason why my group id is 0 is because im using a minecraft plugin to create new forum accounts with their passwords, when the group id is 0 this causes errors on the forum for that users and cannot view or comment on the forum.

It would be great if someone could suggest code edits to my website so that i dont have to manually edit the group id.
Moved to Plugin Support.
Thx for moving the thread i diddnt know where to post this also if anyone could help me with my situation i would be glad to give more info.

Ok so i have been looking all over the internet to find a solution for this but nothing has worked.
What im trying to do it insert some php code into login.php so that when a user logs into the website it will check the groupid to see if it is 0 and change it to 2.
I have tried many diffrent methods such as this

if($mybb->user['usergroup'] == 0 )
{
$db->update_query("users", array("usergroup"=>'2'), "uid={$mybb->user['uid']}");
}

But it comes up with a mysql error of

SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2
Query:
UPDATE mybb_users SET usergroup='2' WHERE uid=