vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Allow Limited Usergroup Changes Through ModCP (https://vborg.vbsupport.ru/showthread.php?t=62018)

Christine 02-27-2004 10:00 PM

Allow Limited Usergroup Changes Through ModCP
 
09 July 2005 UPDATE: Changegroup.php reworked for security

Thanks to boy genius KirbyDE :D this file has been reworked to secure that users who aren't already in your selected groups cannot be changed by your mods (with a check on attempted overrides).

To update, simply upload the new changegroup.php file in the zip to your /modcp/ directory. No other changes/modifications need to be made.

Please post if there are any problems!

######################################

08 May 2004 UPDATE: Modified file for error reported in post #16

Please download the new file and replace the old one with it. Post if there are any problems!

######################################

Hi all!

Here is the deal with this hack. We have usergroups set up with various permissions, mostly based on limiting their functions if they abuse their rights as a member (limiting them from certain forums, putting them under moderation, etc...).

Our mods need to be able to move our members into (and out of) these restricted groups rather than banning them, but at the same time, they should not be able to move members into (or out of) the mod, admin, waiting for confirmation groups, etc...

NOTE: Banned Groups are NOT touched in this hack -- this is for all groups OTHER than those addressed by the banning function as I wanted to keep that seperate!


What this hack does:

  • Add a token to each usergroup that the admin can set to say 'yes' or 'no' that the mods can move users into and out of the group.
  • Adds a token on the mod permissions level -- super mods can change allowable groups by default, and regular mods can only make these changes if you assign it on a mod by mod basis.
  • Adds the functionality to the ModCP for the mods to make the changes.
Changes that need to be made:

Phrases to add: 5

PHP file edits:
  • admincp/usergroup.php (1 change)
  • admincp/moderator.php (1 change)
  • includes/init.php (2 changes)
  • modcp/user.php (4 changes)
New PHP file:
  • changegroup.php (attached in this zip -- upload to your modcp folder)
Included in this zip:
  • Modification .txt file
  • changegroup.php
  • Screenies!
The screen shots below are of the ACP -- adding the tokens to the Usergroup and giving permissions to the mods.

Enjoy, and as always, if anyone has any constructive feedback, or needs any help, post away.

:)

Christine 02-28-2004 09:53 PM

And here are the ModCP screen shots -- this is what the Mod will see when they go to edit the users' usergroups:

Chris M 02-28-2004 11:14 PM

Nice idea for a hack! :)

Satan

Christine 02-28-2004 11:39 PM

Thanks! :)

Our team LOVES this. I wrote it back for 2.0.6 but never released it through the upgrades because it was really messy -- I was lazy and hardcoded the usergroupids directly into the php file. Heh.

:confused:

Limitter 03-06-2004 06:32 PM

Christine
by change from Group come an error

/modcp/changing.php

????

thx

L.

Christine 03-06-2004 10:17 PM

Hi Limitter,

I put the test php file in the zip by mistake. Thank you for finding that!!

I have reuploaded it -- please let me know if you have any problems!

Allan 03-07-2004 05:54 AM

Nice idea Christine :), thanks you :)

Limitter 03-07-2004 07:11 AM

Yes Christine,

thx for your Support and Thx for the Hack my team is Happy :)

*install*

Limitter

OGT 03-28-2004 12:23 AM

From 'mods change usergroups.txt'
Quote:

Replace with:

if (!can_moderate(0, 'canunbanusers') AND !can_moderate(0, 'canunbanusers') AND !can_moderate(0, 'canmodify') AND !can_moderate(0, 'canviewprofile') AND !can_moderate(0, 'caneditsigs') AND !can_moderate(0, 'caneditavatar'))
should the bold text read

PHP Code:

!can_moderate(0'canbanusers'

if not, should it be removed from the if?

Great hack BTW!

sifuhall 04-06-2004 06:46 PM

Thanks for the wonderful hack!

BlackxRam 04-29-2004 11:03 PM

This hack would be even better and like Xenons More Powers for Mods hack if you could DEFINE WHICH groups a Moderator could modify. Could that be implemented? Even if it is hardcoded?

Im trying to allow certain MODS to change only certain groups they are allowed to change. I have 3 differetn mods for 3 different section on my boards and I dont want them messing with other groups.

Could this be added? Maybe by adding the GROUP IDs into the ADMINCP somewhere that a Group can modify.

Christine 04-30-2004 01:25 PM

@ OGT -- Sorry, I missed your post. Let me look at that.

@BLackxRam - This is what this hack does. It adds a radio button into the modify Usergroup section of the Admin CP that says "Modifiable Group" Y/N. If you have this radio button set to Yes on the usergroup, it will show up in the dropdown for the mods. If you set it to no, it won't, so they can't change people into it.

:)


Edit to add -- OGT, that one is a typo that was entered twice but won't hurt anything. I didn't include Banning as that is a seperate permission and I didn't want to exclude those who can't ban from being able to change usergroups. You can take that out as a duplicate entry, or if you want only those who can ban to change groups, change it to canbanusers.

BlackxRam 05-01-2004 05:41 AM

I know I understand that, however what I meant was, I have other mods that I dont want to be able to change certain groups. Like I am looking to have Moderator Group A being able to change usergroups 7, 9, 11 while Moderator Group B can change usergroups 8, 10, and 12. That kind of thing.

BlackxRam 05-01-2004 05:42 AM

Just like Xenons hack for vb2

Christine 05-01-2004 06:45 PM

HI BlackxRam,

I am not familiar with Xenon's vB2 hack as I had written my own back then. I understand what you are looking for now though, but this won't do that without some extensive modifications. Unfortunately, I only use Supermods on my site, so don't have the various mod groups to test this on.

Sorry I couldn't help. You may want to check to see if that hack is in the works to be ported?

Sidewindr 05-04-2004 09:36 PM

There appears to be a bug in changegroup.php if the username being modified has any quotes in the name, see the error below.

Code:

Database error in vBulletin 3.0.1:

Invalid SQL:
UPDATE user SET

usergroupid = 8
WHERE username = 'big_kev's_ss'

mysql error: You have an error in your SQL syntax near 's_ss'
' at line 5

mysql error number: 1064

Date: Monday 03rd of May 2004 08:59:16 PM
Script: changegroup.php


Christine 05-06-2004 01:05 AM

Thanks, Sidewindr - I will fix...

Edit to add: Please download the new zip and replace the changegroup.php with the one you have now and let me know if this is working.

msimplay 05-06-2004 07:35 AM

great hack but now that i use a promotions system
it would be great to allow moderators the ability to add users to additional groups

Sidewindr 05-06-2004 12:10 PM

Yep working like a charm now .. thanks :up:

Christine 05-07-2004 03:01 AM

Thanks Sidewindr. I sent out an update for it. :)

Hi msimplay, That wouldn't take much to do -- just add the checkboxes and the logic for membergroupids to be inserted into the database. As long as you keep the restriction of the usergroups that you set up as modifiable, that is all they would see as options.

:)

Sidewindr 05-08-2004 03:37 PM

Actually it appears to work...

BUT .. It doesn't make the change ... the old one work and the new one doesn't work properly .. the only real difference I can see is the change from ..

WHERE username = '$username'

to

WHERE userid = '$userid'

dang .. had to go back to the old version where it didn't like quotes in names.

Christine 05-08-2004 09:00 PM

That is strange -- I have the new one working?

Let me go see if I can break it...

Edit to add -- it seems to be working fine on my test site still, but I changed the userid to addslashes($username).

Can you try again?

Sidewindr 05-13-2004 08:30 AM

Yep that fixed it :) ... what does addslashes do ?? :o

Christine 05-13-2004 11:29 AM

It escapes any characters that would normally tell php to cut the script short. Instead of username=fred's it makes it username=fred\'s

:)

Thanks for clicking install! :p

TheRayden 05-28-2004 04:56 PM

Very good hack!
At our forum we have a few rules regarding max sig sizes when it comes to graphics and text, at least I can allow our mods to change those sigs without giving them full access to the modcp.

Installed, and worked like a charm.
Well done.

note: one question, I can only seem to set this on a mod per mod basis. Is there a way to do this for an entire usergroup?

BlackxRam 05-29-2004 07:38 PM

Come on Christine.. you know you are able to make it use various mods for different groups... i would be eternally grateful because Xenon isnt working on it he said.

Christine 05-30-2004 11:58 AM

Hi TheRayden,
Quote:

Originally Posted by TheRayden
note: one question, I can only seem to set this on a mod per mod basis. Is there a way to do this for an entire usergroup?

That is by design for the mods. SuperMods and Admins have these rights by default.



Hi BlackxRam,

Sorry -- there are just not enough hours in the day. It shouldn't take too much to modify this to do that, but as I said, I am only using SuperMods, so wouldn't even be able to test it on a live environment if I did have time.

Spydertech 07-29-2004 03:02 AM

OK - I've searched and can't find it...
Christine - this is the closest hack I've seen to what I am wanting to do.
Maybe you can help....

I want the mods and supermods to be able to change userstitles (and change the Custom Title Allowed) along with the group change....
But I don't want them to be able to globally change usergroups - so AdminCP access is out of the question...

Is there a way to implement Usertitles (and CustomUserTitle) into your hack?

Thanks,
Spydertech

Christine 07-31-2004 12:24 PM

Hi Spydertech,

Are you saying that you want mods to override the default ladder of titles:groups, or are you wanting the system to assign the appropriate title that belongs to the group when the group is changed?

Spydertech 07-31-2004 02:20 PM

I would like the mods to be able to override the default ladder of titles for the a few of the user groups..

i.e. a mod can "play around" with a users titles over-riding the Ladder of titles I have previously setup - (only in certain groups if that is possible)

BTW - Thanks!! The user group mod is extremely helpful!

Spydertech

Christine 07-31-2004 02:33 PM

Ok -- will look at that for you. Give me a few days as I am trying to fix a few things to get 3.0.3 up.

:)

Spydertech 07-31-2004 02:36 PM

Thanks again!!

:)

teksigns 10-07-2004 02:20 PM

would it be possible to modify this code to add users into
a secondary usergroup rather than moving them.....

i would rather moderator be able to add secondary usergroups
and remove secondary groups .....

House_of_Crazed 10-13-2004 10:45 PM

I was thinking the same, Teksigns :)

*shrugs*

Burley 11-17-2004 12:06 PM

Hi Christine,

Great hack. Clicks install

But i've got some questions for you.
On my forum we have several user groups with private forums. I was thinking of using your hack to allow the mods of those forums to add and remove users from those groups (and thus from that part of the forum).

It all works, however the mod of group A can move users to group B. That should not be possible. Mods should only be allowed to grant or remove acces to their own forum.

Can you help me out with this?

Praxin 12-12-2004 03:30 PM

Nice hack - finally got around to installing it, after a few months of lazyness ;)

One thing I had to do was an additional hack to modcp/index.php - the moderators that have access to this hack dont actually have any other 'user' mod privileges, so this was needed ;)

Code:


Find :

if (can_moderate(0, 'canunbanusers') OR can_moderate(0, 'canbanusers') OR can_moderate(0, 'canviewprofile') OR can_moderate(0, 'caneditsigs') OR can_moderate(0, 'caneditavatar'))

and Replace with :

if (can_moderate(0, 'canunbanusers') OR can_moderate(0, 'canbanusers') OR can_moderate(0, 'canmodify') OR can_moderate(0, 'canviewprofile') OR can_moderate(0, 'caneditsigs') OR can_moderate(0, 'caneditavatar'))

Hmm - an addition to the above - I just managed to remove my own admin access using a simple, very little access, mod account. Whereas this isnt a problem for my boards because the only mods with this access are within easy reach if they do mess something up, this could be a problem for boards which may have a disgruntled mod.

There are no checks in changegroup.php at all to check what group the user being moved is a member of.

Praxin 12-14-2004 10:16 AM

Also, this mod completely ignores the unalterable users feature

Christine 12-27-2004 03:20 PM

Hi all,

My apologies -- I have been traveling and totally forgot about the request for secondary groups. I will look at that this week.

Praxin, I am not sure what you are referring to, but in the hack, each usergroup can be set in the ACP as 'modifiable' or not. If you set Admins to not be modifiable, then admins will not be able to be changed by mods and additionally, the option to change someone into an admin will not be an option for mods.

Praxin 12-30-2004 02:41 PM

As per attached - admin usergrp is set to no, and it is ignored

Christine 12-30-2004 03:33 PM

Hi Praxin,

Can you screen shot the dropdown in the mcp for usergroup changes?


All times are GMT. The time now is 04:50 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01336 seconds
  • Memory Usage 1,822KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete