closetable();
opentable("Sign Up in one or more Usergroups!");
echo "Content panel";
closetable();
Quote
hedonism wrote:
Thanks Diemux. I didnt' realize I needed to change openside to opentable. I was hoping to allow users to join groups upon registration if possible, but it works great inside of edit_profile once a registration is complete.
if(iMEMBER) {
opentable("User Groups");
///this is an array. input the id of the groups users are allowed to join, comma separated
$groups = array(3,4,2,6,1,5,7,8);
/// controls max width of the button that displays of the user_group name
$max_width = 150;
if(isset($_POST['group_name'])) {
$group_name = trim(preg_replace("(Join|Leave)","",$_POST['group_name']));
$group_id = dbresult(dbquery("SELECT group_id FROM ".DB_USER_GROUPS." WHERE group_name = '".$group_name."'"),0);
$groups = explode(".",$userdata['user_groups']);
if(in_array($group_id,$groups)) {
$user_groups = ereg_replace(".".$group_id,"",$userdata['user_groups']);
dbquery("UPDATE ".DB_USERS." SET user_groups = '".$user_groups."' WHERE user_id = '".$userdata['user_id']."'");
}else {
$user_groups = $userdata['user_groups'].".".$group_id;
dbquery("UPDATE ".DB_USERS." SET user_groups = '".$user_groups."' WHERE user_id = '".$userdata['user_id']."'");
}
redirect(FUSION_SELF);
}
echo "<form action='".FUSION_SELF."' method='POST'>";
foreach($groups as $group_id) {
$group_name = dbresult(dbquery("SELECT group_name FROM ".DB_USER_GROUPS." WHERE group_id = '".$group_id."'"),0);
$groups = explode(".",$userdata['user_groups']);
if(in_array($group_id,$groups)) {
echo "<input type='submit' align='center' value='Leave ".$group_name."' class='button' name='group_name' style='width:{$max_width}px;overflow:hidden;'>";
}else {
echo "<input type='submit' align='center' value='Join ".$group_name."' class='button' name='group_name' style='width:{$max_width}px;overflow:hidden;'>";
}
echo "<br />";
}
echo "</form>";
closetable();
}
Category Forum
Content Administration - 8Labels
None yet
Statistics
3 participants
Notifications
You are not receiving notifications from this thread.
Related Questions