View Full Version : Mods can add/remove users

10 Jan 2003, 00:10
Mods can add/remove users
(by Martin64, martin64@vbhackers.com)


A hack that's useful if you want your mods to be able to add and remove users. Your mods will not be able to create admins or mods (we don't want them to create admins so they can take over, do we? :p). They are only able to remove users from the registered group.


- Mods are able to create users other than admins and mods through the Mod CP.
- Mods are able to delete registered users through the Mod CP.
- Select which mods are allowed to add/remove users from Admin CP (Edit Moderator)

Hack requested by mauce in the following thread: http://www.vbulletin.org/forum/showthread.php?s=&threadid=47541

10 Jan 2003, 00:19
can u do it so that only user id x, y & Z can create users ?

sorry my english is very bad !

THX for coding !


10 Jan 2003, 01:09
this seems ok, but then wouldn't that just create spammed/dupe members? i might try this one, but if i get too many new members that i don't want i am gonna get rid of it

10 Jan 2003, 01:31
As requested by kalle, you are now able to select which moderators that are allowed to add/remove users. :)

10 Jan 2003, 07:23
Great work, I'll check it out.
Many thanks!!!

10 Jan 2003, 11:01
No problem, I hope it'll work like you want it to. :)

10 Jan 2003, 16:32
Thank m8, the hack works fine......
.... however :)

I used this in combination with Xenon's mods_can_edit_user-hack.
Now I face the following problem:
When a mod adds a user the usergroup will be "(COPPA) Users Awaiting Moderation", but I like to define a personal defined usergroupid (of course no admin).
In this case (wich is always the case), a moderator still has to go to the admin to change the usergroup of the new user.
I also tried to make the usergroupid of "(COPPA) Users Awaiting Moderation" 'moderatable' in Xenon's hack, but that didn't work (dunno why).
So the solution what I'm thinking of is a definable usergroupid for users that are added by a moderator.

What should I change to make this working?

Thanks in advance (again!).

Chris M
10 Jan 2003, 22:26
Unless I am mistaken, this hack for the modifications to mod/user.php does not have a check for the usergroupid in the query you are running when you add a user:bored:


11 Jan 2003, 09:20
Great hack!

I have some requests to it though:

1. In the mod/smod usergroup list, a link should be displayed to view what users the mod/smod added and removed.

2. Mod/SMods can add users in differnt usergroups, except Mod/SMod/Admin. Like a new usergroup called added by mods...

Other than that, it is a very good hack!

11 Jan 2003, 13:05
Originally posted by hellsatan
Unless I am mistaken, this hack for the modifications to mod/user.php does not have a check for the usergroupid in the query you are running when you add a user:bored:


Good spot, I'll fix that.
Please forgive me for the mistake, I made this at 2am in the morning and as a request. :P

EDIT: New instructions attached.

Chris M
11 Jan 2003, 13:27
Hehe no problems;)


11 Jan 2003, 13:44
New instructions added. The security bug hellsatan noticed has been fixed, and mods are now able to select which usergroup the added user goes in. However, they are not able to create admins and mods. I believe this answer both mauce's and Jadelit's requests. :)

11 Jan 2003, 14:46
Thanx Martin64, but what is the delta with the former version?
I already tried the hack in first place, so what are the upgrade instructions ?

I tried to figure out the delta myself....
There is a nice pulldown list of usergroups now (well done) however, the groups moderator and supermoderator are in the list as well (but not administrators).
Where in the script we can define the usergroupid's that appear in the pull down list? Or is this possible at all?

Please advice and thanks again

12 Jan 2003, 11:24
To upgrade, you just need to re-do the changes to mod/user.php as it's the only thing that's changed. The list of usergroups you can select from is pulled from the database, so all your usergroups should be listed (admins as well).

13 Jan 2003, 14:32
The easiest way to do that would be to open mod/user.php and...


if ($usergroupid==6 or $usergroupid==5 or $usergroupid==7) {
echo "<p>You can't add admins or mods!</p>";


if ($usergroupid==6 or $usergroupid==5 or $usergroupid==7 or $usergroupid==XX) {
echo "<p>You can't add admins or mods!</p>";

Replace the XX with the ID of the usergroup you don't want your mods to be able to add users to.

13 Jan 2003, 14:33
Humm...you removed the post, mauce? :)

13 Jan 2003, 17:17

that's because I found that out myself just now, and removed the post immediately.
Didn't notice your quick reply in the first place.

Thanks for your reply anyway Martin,