MyBB Community Forums

Full Version: [Release] Button to Join in a group
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm here to teach you to create a button to join in a group.

Ex:

{button}Click here to join in NAME GROUP{button}
After you click button you'll redirect in usercp.php and you'll join in the group automatically.

First, insert this in a template where you'd view the button:
<form action="" method="GET">
<input type="hidden" name="enter" value="IDGROUP">
<input type="submit" value="Click here to join in NAME GROUP!"></form> 

Then insert this before
?>
in global.php

if ($mybb->user['uid']) {
$lang->load("usercp");
if ($mybb->input['enter'] == "IDGROUP") {
$group = intval($mybb->input['enter']);
$query = $db->query("UPDATE ".TABLE_PREFIX."users SET usergroup = ".$group." WHERE uid = ".$mybb->user[uid]."");
redirect("usercp.php?action=usergroups", $lang->display_group_changed);
    exit;
}
} 

Naturally you must modify IDGROUP in all code in this thread Wink
Good Luck
any screenshot for this tutorial?
screenshot please...