Helpful Information
 
 
Category: Member Archives
Changing userid for users being banned from modCP

// ###################### Start doban #######################
if ($HTTP_POST_VARS['action']=="doban") {
$perms=getpermissions();
if (!$perms[ismoderator] and !$ismod=$DB_site->query_first("SELECT * FROM moderator WHERE userid=$bbuserinfo[userid] AND canbanusers=1")) {
echo "<p>You do not have permission to do this!</p>";
exit;
}

$banuser=$DB_site->query_first("SELECT username,userid,usergroupid FROM user WHERE userid=$userid");
$ismod=$DB_site->query_first("SELECT moderatorid FROM moderator WHERE userid=$userid");
if ($banuser['usergroupid']!=2 or $ismod) {
echo "<p>You may not ban someone who is not a normal registered user!</p>";
}

$bangroup=$DB_site->query_first("SELECT usergroupid,title FROM usergroup WHERE title='Banned by Moderators'");
if (!$bangroup) {
$DB_site->query("INSERT INTO usergroup
(usergroupid, title, usertitle, cancontrolpanel, canmodifyprofile, canviewmembers,
canview, cansearch, canemail, canpostnew, canmove, canopenclose, candeletethread, canreplyown,
canreplyothers, canviewothers, caneditpost, candeletepost, canusepm, canpostpoll, canvote,
canpostattachment, ismoderator, canpublicevent, canpublicedit, canthreadrate, cantrackpm,
candenypmreceipts)
VALUES
(NULL, 'Banned by Moderators', 'Banned', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')");
$bangroup['usergroupid'] = $DB_site->insert_id();
$bangroup['title'] = 'Banned by Moderators';
}

if ($bangroup['usergroupid']>6) {
$DB_site->query("UPDATE user SET usergroupid=$bangroup[usergroupid] WHERE userid=$banuser[userid]");
echo "<p>$banuser[username] has been banned!</p>";
} else {
echo "<p>An unknown error occured while attempting to ban $banuser[username] ($banuser[userid]). The group the user was supposed to be moved to was \"$bangroup[usergroupid]\"</p>";
}
}

// ###################### Start viewuser #######################




That's the code from the root/mod/user.php

See where it says:


$bangroup['usergroupid'] = $DB_site->insert_id();
$bangroup['title'] = 'Banned by Moderators';
}


If I wish to change the group which users banned by moderators go into, do I just change 'Banned by Moderators' to the name of the group I want them to go into? Or is there more to this?

You need to change each instance of 'Banned by Moderators' that appears in that large chunk of code to the name of the group you want them to go into.

Ok I searched and replaced Banned by Moderators with Banned in that code and it works flawlessly :)










privacy (GDPR)