MyBB Community Forums

Full Version: Super Mods can ban users but cannot ban Admins
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Like the title says. I need a mod that will only allow the Super Mods to ban users apart from the Admins.

- Bobby
bwah, should be easy to do I guess. I'll have a look at it tonight.
EDIT: I can't seem to make it work. I'm sorry I can't help with this.
I think this should be standard in Gold
A mod CP with this type of thing should be coming in a future version. Perhaps you can wait till then?
wow! are we thinking 2010 here? Ok, ill try my best to persuade Chris (LOL),

To Dear Chris:
I currently have a copy of your forum software [Contents Removed - Things I dont want mentioned anymore], and i have about 8 super moderators who would love to ban the occasional ba$t@rd. At the moment, when giving a super mod access to the admin CP, they are able to ban any group they wish, including the Administrators. So, my plead is this. When you have the time (I know its scarce, but ive heard they have a hidden stash of it at the corner shop), well you dont have to make a whole new Mod CP or something like that, but, at least prevent the super mods from banning admins. I, as well as many other people, would like to also see this (c'mon people support me here... fine run away, u lazy bums...) mod, and we would truly pay our respects to you (...stupid lazy, son of a bi...).

Your "Best" Mate (Note how i emphasise)
- Bobby
(...Chris, Please...)
Chris is too busy with TAFE, and a whole lot of other stuff. And I'm busy with school. If someone else wants to help, thats great, but otherwise, please just wait for the Mod CP in a future version! Or learn php and do it yourself (shouldn't be too hard, just check if the person being banned is an admin, if so, show a redirect saying your not allowed to ban them!).
I've managed to make it work. I was working in the wrong file the previous time.
* Smethead slaps himself!!

Here is what you have to do, tmhai. I also described what the code means, if you want to know it. It's quite simple Toungue

* First you open the file admin/users.php. Find the following code:
		if(!$ban[uid])
		{
			cperror($lang->error_not_banned);
		}
It should be around line 1256. Don't remove these lines, but right under it, add these:
		if($user[usergroup] == 4 && $mybbadmin[usergroup] != 4)
		{
			cperror("This user is an administrator. You cannot ban him/her!");
		}
Make sure they are above $bancheck = $ban;. Now scroll a little bit down, to find the code
		if(!$user[uid])
		{
			cperror($lang->error_not_found);
		}
Don't remove these lines, just add the same code you added the previous time right under this. Make sure it is above $query = $db->query("SELECT * FROM ".TABLE_PREFIX."banned WHERE uid='$user[uid]'");!!!

Now, what does this little pieces of code actually do? Very little, but exactly what you asked. The code checks if the to be banned user is an admin, and if the banning user is an admin. If the user you wish to be banned ($user) his usergroup is 4 (default for administrators) and the user who is trying to ban the other ($mybbadmin) his usergroup is not 4, you'll get an error saying the user is an admin, and you cannot ban him/her.
If the user, who is trying to ban an other admin, is an admin, he can still ban him. I believe this is handy. Just make sure you trust the right people Smile
Ur always a great help Smethead! Thanks, again.