MyBB Community Forums

Full Version: Plugin to change usergroup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Right now I have a form that submits it to my admincp to change the usergroup however the session ids are different there so it asks you to log in first

What else can I do? I was thinking of just doing an SQL query on their UID.

$db->query("UPDATE '.TABLE_PREFIX.users' SET usergroup=\"$usergroup\" WHERE uid=\"$memprofile['uid']\");
* note that this query will likely not work and has a lot of issues so yeah

How practical would that be? Automatic update?
I think that is what MyBB does.. but use the update_query() method instead.

$db->update_query('users', array('usergroup' => (int)$newusergroup), 'uid=\''.(int)$memprofile['uid'].'\'');
So I plan on adding {$closeaccountbutton} to templates, which basically executes that. Would I need to use a pre hook for the specific page to define that variable? Basically all I do is have a button, when ran it runs the query and displays a nice OK message.
If you want it available on all pages, I'd recommend hooking to global_end.