PDA

View Full Version : Mods edit access masks including child forums


Scott MacVicar
22 Sep 2001, 21:43
There was another version around on the board but it had problems with moderators who had access to moderate a forum through inheritance, ie they were moderator of a category. This code is in no way based on the other version, but no doubt will be similar as there isn't really much of a difference you can make.

This is just really an alternative to letting mods ban people from the whole forum, they can simply ban from a single forum.

Once you have done what it says in the instructions when you add a moderator you will have permission to say if they can edit forum access masks for that particular forum. Remember if they are mod of a category and the edit acccess masks option is enabled then all the forums in this category moderated by the user through inheritance have the ability.

Supermods and Admins can edit all access masks via the mod control panel.

This has been tested on
vb 2.0.1, 2.0.2 and 2.0.3 they all work
also tested on
vb 2.2.0 and 2.2.1 these also work.

I had a small error in the permissions checking for the updateaccess which i just noticed and corrected, so if you have installed this before November 21st it may be advisable to update the /mod/user.php part which involves the updateaccess part.
Not that your mods would want to change access masks for forums they don't mod :)

Bitmap
02 Nov 2001, 15:24
hey ... this hack is great!
i think it works with 2.2.0 as well :) i just installed it.

Martyjp
03 Nov 2001, 14:14
Just installed it on 2.2.0 and it works great

There is a slight change in mod/index.php

on line 145 below
<a href="user.php?s=<?php echo $session[sessionhash]; ?>&action=find"> View </a> |
add
<a href="user.php?s=<?php echo $session[sessionhash]; ?>&action=find"> Edit Acess Masks </a>

will be

Change
makenavoption("View","user.php?action=find");
to
makenavoption("View","user.php?action=find","|");
makenavoption("Edit Access Masks","user.php?action=find");

Scott MacVicar
03 Nov 2001, 15:53
Whoops i updated the top message and forgot to update the file.

Your right thats the only change from 2.0.x to 2.2.x

SharkY-GA
03 Nov 2001, 21:07
OMG!!! Thank you thank you thank you!! I love you!! :D

Scott MacVicar
03 Nov 2001, 21:34
i love me to :cool:

i'm glad its working for everyone on vb 2.0.x and 2.2.x.

SharkY-GA
03 Nov 2001, 21:46
My stupidity! Sorry! :P

mcncyo
07 Nov 2001, 12:34
I am getting this error

Database error in vBulletin Control Panel 2.2.0:


Invalid SQL: SELECT username FROM user WHERE userid=
mysql error: You have an error in your SQL syntax near '' at line 1


mysql error number: 1064


Date: Wednesday 07th of November 2001 06:26:21 AM
Script: http://www.christian-forum.com/admin/forum.php?action=editmoderator&moderatorid=13
Referer: http://www.christian-forum.com/admin/forum.php?action=modify




I did had the other hack version installed when i had 2.0.3 now i have 2.2.0

Scott MacVicar
07 Nov 2001, 17:06
the edit moderator part of /admin/forum.php should look like this

// ###################### Start edit moderator #######################
if ($action=="editmoderator") {

$moderator=$DB_site->query_first("SELECT forumid,userid,newpostemail,newthreademail,caneditposts,candeleteposts,canviewip s,canmanagethreads,canopenclose,caneditthreads,caneditstyles,canbanusers,canview profile,canannounce,canmassmove,canmassprune,canmoderateposts,canmoderateattachm ents,caneditaccess FROM moderator WHERE moderatorid=$moderatorid");

you have an error with this part

Nam
08 Nov 2001, 04:09
Sorry for stupid question, I installed it, had no problem, but where is the access mask control panel for mod? I logged in as mod, but couldn't find where, and I did turn access list ON in the control panel option.

Scott MacVicar
08 Nov 2001, 08:07
did you add the new bit to /mod/index.php and upload?

it should be a new option that says [Edit Access Masks] in the menu, click it and it will prompt you to find a username.

Nam
08 Nov 2001, 11:31
got it now, thank you :).

Snake~eyes
12 Nov 2001, 23:39
I am having some problems with installing this hack. I can't get the link on the mod/index.php page to show.


Here's what I have

// *************************************************
makenavoption("Add","announcement.php?action=add","|");
makenavoption("Edit","announcement.php?action=modify");
makenavselect("Announcements");
// *************************************************
makenavoption("New Posts","moderate.php?action=posts","<br>");
makenavoption("New Attachments","moderate.php?action=posts");
makenavselect("Moderation Lists");
// *************************************************
makenavoption("Ban","user.php?action=find","|");
makenavoption("View","user.php?action=find","|");
makenavoption("Edit Access Masks","user.php?action=find");
makenavselect("User Actions");
// *************************************************
makenavoption("Mass Move","thread.php?action=move","<br>");
makenavoption("Mass Prune","thread.php?action=prune");
makenavselect("Thread Control","<hr>");
// *************************************************


I don't think any of it is working right but is there somthing wrong wtih this?

Scott MacVicar
13 Nov 2001, 13:16
did you remember to upload the new /mod/index.php

the code that you have there is correct if not then its a problem with cache.

Snake~eyes
14 Nov 2001, 20:15
I figured that was the problem.. Tried today and it worked!

Awsome hack!

thx

Scott MacVicar
14 Nov 2001, 21:23
no problem

i also forgot to upload the /mod/index.php while doing it and spent 20 minutes perplexed :p

Nemesis77
21 Nov 2001, 01:28
Is there a way to set this hack to allow a Mod to edit the access mask of another mod. becasue right now it says Can't edit access masks of someone who is not a regular user or something like that. See there is a Ladies forum on the borad, ladies only, but males are allowed if the mod of the foums invites them. She want to invited some of the other Mods that are male but when she edites their access masks to give them access to the laddies only forum she get's that message.

Scott MacVicar
21 Nov 2001, 17:15
change

if ($edituser['usergroupid']!=2 or $ismod) {

in /mod/user.php too

$editperms=getpermissions(0, $userid);
if ($perms['cancontrolpanel']) {

this should work :)

Nemesis77
22 Nov 2001, 00:21
Thanks. I'll give this a try later tonight.

ladyfyre
01 Dec 2001, 19:05
will this hack also allow mods of private forums to GRANT access through access masks for their forum????

Bitmap
02 Dec 2001, 01:02
Originally posted by ladyfyre
will this hack also allow mods of private forums to GRANT access through access masks for their forum???? yes ... i think so :)

Snake~eyes
02 Dec 2001, 03:03
Originally posted by ladyfyre
will this hack also allow mods of private forums to GRANT access through access masks for their forum????

It will work if you follow these instructions:

Originally posted by PPN
change

if ($edituser['usergroupid']!=2 or $ismod) {

in /mod/user.php too

$editperms=getpermissions(0, $userid);
if ($perms['cancontrolpanel']) {

this should work :)

Wayne2k1.com
19 Dec 2001, 14:15
Great hack, man!

Exactly what I was looking for.

Thanx.

Snake~eyes
09 Jan 2002, 14:48
I'm havin some problems and getting a dumb error,

help please...

Database error in vBulletin Mod Control Panel 2.2.1:

Invalid SQL: SELECT * FROM moderator WHERE userid=
info[userid] AND (canbanusers=1 OR canviewprofile=1 OR caneditaccess=1)
mysql error: You have an error in your SQL syntax near '[userid] AND (canbanusers=1 OR canviewprofile=1 OR caneditaccess=1)' at line 2

mysql error number: 1064


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm not trying to do anything and I guess this is from adding the moderator hack - that allows mods to edit access masks
i get that error in the email. It's when moderators try to add access


Why am i getting this erro all of a sudden? :(

Help is appreciated,

thx

Scott MacVicar
10 Jan 2002, 11:29
i have a feeling that

info[userid] should be $bbuserinfo[userid]

don't know where the $bbuser went

Martz
10 Jan 2002, 12:06
Great hack PPN - I'd love to see a usergroup version of this!

Scott MacVicar
10 Jan 2002, 17:22
i'll see what i can do for you, I don't think it should be too much bother though.

Martz
10 Jan 2002, 18:29
Well, instead of having a list of forums which they can grant access on, instead a list of usergroups that they can move the user into. (excluding moderators, admins, or even using a system that checks if the usergroup has a setting such as allowmodchange group checked.


1 optional thing for me would be not to let the user be moved into a different usergroup unless they are in the registered usergroup already. This would mean a moderator (with permission) has to release them from their current group back into registered.

Just a thought, I don't expect anyone to do any of this! The access list one is pretty smart, but usergroups are easier to keep track of imho.

Snake~eyes
10 Jan 2002, 20:31
ya lost me :confused:

Could ya give me some idiot proof instructions? :D

Scott MacVicar
10 Jan 2002, 21:33
open up mod/user.php look for

SELECT * FROM moderator WHERE userid=info[userid] AND (canbanusers=1 OR canviewprofile=1 OR caneditaccess=1)

change to

SELECT * FROM moderator WHERE userid=$bbuserinfo[userid] AND (canbanusers=1 OR canviewprofile=1 OR caneditaccess=1)

you've copied some of the text wrongly and missed out parts of the query.

Snake~eyes
10 Jan 2002, 22:41
Okay..

the wierd thing i was having the main problem with was that i never edited that file then all of a suddent it didn't work. that's why i asked, if you look a couple posts bafck i had it working.

thankyou - great support

also, i have a quesiton.

I don't know if this is your hack or the boards but here it goes.

I add moderators to boards and if i say add a moderator to board a he has acces to board b which is privated. It automatically gives it to him. Any ideas? and i don't want this.

What i'm saying is i add a mod to one board and he has access to evrything - i just want him to have access to his priv board that he moderates


thx

Scott MacVicar
11 Jan 2002, 01:13
does it simply show all of the forums when he goes to the page which lists access masks in the mod control panel?

--------------------------

other problem could be that you may have the access masks set for the private forum so that all moderators can see it.

Snake~eyes
11 Jan 2002, 02:06
no

what happens is they automatically have access - they can only change masks to their forums - but as soon as i make someone a mod they get all the permissions for the private forums.

other problem could be that you may have the access masks set for the private forum so that all moderators can see it.
how do i change that? ^^^^^^^

Snake~eyes
12 Jan 2002, 20:03
^^^^^^^^^^^^^^^^^^^^^
*bump*

Scott MacVicar
12 Jan 2002, 22:23
Admin Panel > Usergroups > Forum permissions

is where they are contained, there is nothing in the code which would allow mods to see private forums, unless they are a mod of that forum or category and they set it themselves for them to see it using this hack, that is the one issue.
I'm gonna have to find a solution to that, as one of my mods gave themselves permission to see the admin forum as they were a mod of the category they were in.

Snake~eyes
13 Jan 2002, 00:55
okay.. but i don't put my mods ina user group. they're all normal registered users. The way they become mods is

Modify forums -> add moderator

But i just don't get why when they become a moderator they get access toe vrey.. doesn't make sense

Martz
13 Jan 2002, 01:01
Originally posted by dhogan444
no

what happens is they automatically have access - they can only change masks to their forums - but as soon as i make someone a mod they get all the permissions for the private forums.


how do i change that? ^^^^^^^

Your running into the same problems as I did :)

When you add a moderator, they automatically get shifted into the Moderators usergroup, and access masks are set for all private forums.

This is how my ### Start Insert ### in admin/forum.php looks

$mods=$DB_site->query("SELECT DISTINCT moderator.userid FROM moderator,user WHERE moderator.userid=user.userid AND user.usergroupid<>6 AND user.usergroupid<>5");
if ($DB_site->num_rows($mods)) {
while ($mod=$DB_site->fetch_array($mods)) {
$accessto[] = $mod['userid'];
}
while ( list($key,$userid)=each($accessto) ) {

// CODE EDIT BY MARTZ!!!
// Line was commented out to stop custom permissions for all moderators on the board being assigned
// when a new private forum is added.

// $DB_site->query("INSERT INTO access (userid,forumid,accessmask) VALUES ('$userid','$forumid',1)");
}
}
}



It's messy I know, but it solves the problem. :)

HTH

Snake~eyes
13 Jan 2002, 05:10
can you tel me where to put this? lol

i'm no genius - hell, i'm a dumb idiot

Scott MacVicar
13 Jan 2002, 11:17
in /admin/forum.php

look for

$DB_site->query("INSERT INTO access (userid,forumid,accessmask) VALUES ('$userid','$forumid',1)");

put a double slash (//) or a hash (#) in front of it, these are the simpliest ways to comment it out.

Snake~eyes
13 Jan 2002, 15:56
sounds simple enough

Snake~eyes
13 Jan 2002, 16:15
great, thx guys!

great support!

Scott MacVicar
13 Jan 2002, 16:21
Martz knew that one, i've never had a problem with it :D

SharkY-GA
15 Jan 2002, 19:45
I'm stuck on getting the access to work for some reason... Moderators with access to authorize members are getting "Do not have access."
This didnt happen on 2.2.0, no idea why on 2.2.1...

Scott MacVicar
15 Jan 2002, 20:41
ensure the column was created, ensure that they are mods of that forum and mod access mask editing is enabled for that forum. Check you made the changes in /mod/index.php

do they get an error when they try to search for the user to edit access masks for or is it when they click the link to edit the user that they found's access mask?

SharkY-GA
16 Jan 2002, 02:24
The error is when they try and search for a user.

SharkY-GA
17 Jan 2002, 07:49
*bump*
checked all of that and still can't figure out why it's not working...

Scott MacVicar
17 Jan 2002, 08:06
check this stage again

on line 45 and 59 change
if (!$perms[ismoderator] and !$ismod=$DB_site->query_first("SELECT * FROM moderator WHERE userid=$bbuserinfo[userid] AND (canbanusers=1 OR canviewprofile=1)")) {
to
if (!$perms[ismoderator] and !$ismod=$DB_site->query_first("SELECT * FROM moderator WHERE userid=$bbuserinfo[userid] AND (canbanusers=1 OR canviewprofile=1 OR caneditaccess=1)")) {

thats the only part that would cause an error, either that or the mods don't have permission to edit access masks for that forum.

SharkY-GA
17 Jan 2002, 21:36
Ok... Well that fixed that issue, now i'm flat out getting this:
"You may not edit access for someone who is not a normal registered user!"

Thanks in advance dude.

Scott MacVicar
17 Jan 2002, 22:43
you can only edit users in the usergroup 2, this is the registered usergroup, so you can't edit the access masks for admin or mods :)

SharkY-GA
18 Jan 2002, 06:36
That's what I figured, however it says that for registered users too... Hmm...

Scott MacVicar
18 Jan 2002, 16:15
i feel stupid now, i just noticed a bug :)

sorry about this

change the following

look for
$edituser=$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");

change the $ismod to $is_mod here, it only needs to be done once and only at that point, then change the following.

if ($edituser['usergroupid']!=2 or $ismod) {
echo "<p>You may not edit access for someone who is not a normal registered user!</p>";
$stop=1;
}

change the $ismod to $is_mod i'd never noticed this as i've always used supermod and admin to test this never normal moderator. I recommend that all people update this to deal with this problem.

I just updated the main file at the top.

Sven
18 Jan 2002, 16:37
Still the same....

if ($edituser['usergroupid']!=2 or $ismod) {
echo "<p>You may not edit access for someone who is not a normal registered user!</p>";
$stop=1;
}

I just commented this out and it works

Scott MacVicar
18 Jan 2002, 22:42
change

if ($edituser['usergroupid']!=2 or $ismod) {
to
if ($edituser['usergroupid']!=2 or $is_mod) {

and
$ismod=$DB_site->query_first("SELECT moderatorid FROM moderator WHERE userid=$userid");
to
$is_mod=$DB_site->query_first("SELECT moderatorid FROM moderator WHERE userid=$userid");

please make sure you get the right one as there is an identical one that uses $ismod and this is what causes problem, I had two things with the same variable, i don't recommend commenting it out as this allows mods to edit the access masks of anyone, including their own.

Shenlong
19 Jan 2002, 03:10
wonderful hack, my mods are very satisfied, thanx PPN

SharkY-GA
19 Jan 2002, 09:21
Yay, thanks dude. This makes my life a whole lot easier especialy when it comes to my clan forums.

Snake~eyes
22 Jan 2002, 21:59
i'm back again. I know i'm probaly getting on your nerves and I apologize.

I made them mods but they're getting the msg

"You do not have permission to do this!"


Where would my error be?

note: this makes no sense because it WAS working.

Snake~eyes
23 Jan 2002, 19:42
OKay.. i figured out the error with some hard work.. but i got it working.


Would it be possible to expand this hack so moderators could edit the style of their forums?

Martz
23 Jan 2002, 23:55
There is a beta hack to edit the styles in the beta hacks forum. I tried installing it a few times, but I messed it up.


I think a joint venture to make a mods control panel would be cool :)

Snake~eyes
24 Jan 2002, 00:13
yeah i noticed that after i made the request. But still it'd be cool to have this all in one hack.

I'm interested in installing it so clans can get their own customized layout.

Martz
24 Jan 2002, 00:15
Yep, and I for the same reasons. Theres quite a few clan runners out there using vB - which is why I think there is a market for a Community Hosting Control Panel, as I call it on our forums.

Snake~eyes
24 Jan 2002, 00:35
yeah.. a lot of clans want to have control over their boards.. or else the'll flee to ezboard

juno
26 Jan 2002, 10:34
Great hack!! Just installed and tested it with no problems!!


I've been waiting for a hack like this for a longtime. I was using that old password hack, but no more... thanks again!

Nightman
01 Feb 2002, 11:57
Great Hack..very cool...

i have only one problem....when i have subforen with in the private forum, the moderator is automaticly the same likein the main private forum....because the gets the same rights as the main forum....but the mod can't change the access for the forum..the chield forum isn't be visible in your hack...

anybody an idea?

i have testet to make mod again for the new forum..it works....but in the forum display the moderator was twice ....not so very nice

dieKetzer
07 May 2002, 11:05
Will this work on 2.2.5?

Wayne2k1.com
07 May 2002, 11:40
Yes it does.

:bunny:

dieKetzer
07 May 2002, 11:53
Sweet.
This works beautifully in 2.2.5 ;)

Thanks!

dieKetzer
12 Jun 2002, 20:25
And another easy install on 2.2.6 :)
This hack rules supreme!
It is The God of Hacks!

Chris M
12 Jun 2002, 20:53
Brilliant hack!

Satan

Doogie
02 Nov 2002, 00:30
I'm having problems with this hack on 2.2.8. I installed it again, as I have after every upgrade (getting real good at this now) and I can't work out where the problem is. The code is 100% correct as I've pored over it for hours.

It all seems to work, but when the moderator goes to edit the access mask it just brings up a blank frame. There's no indication in either the access log for apache or the error log, so I'm a bit stumped. Has anyone else got it working on 2.2.8??

Sadie Frost
23 Dec 2002, 13:59
It's working for me. I followed the instructions in the first post. :)

MajBoothroyd
25 Jan 2003, 14:46
Alright, I'm being lazy... or I'm just tired. Anyone care to pour over the current distro and tell me why my mods just lost the ability to view user profiles since this update? It's just them, emods (smods) and admins are fine.

Other thing is, I'm assuming E-mod's are supposed to be able to edit the access for all forums, even private ones they, ironically enough, even they're not supposed to have access to?

I don't truly care about the second part as it's no big secret what we do there, it's just boring crap about running the main site. However mods no longer being able to snoop through peoples profiles is annoying.

(still using vb2.2.7)

MajBoothroyd
27 Jan 2003, 10:46
Seems that all my mods listed in the Moderators table "canviewprofile" setting was reset to 0. I'm betting this has more to do with some "persons" actions now. Other than that one snag everything was great, and works perfect now.

glenmax
19 Mar 2003, 15:37
Question:

I have been using this for some time. It is great. But, I have noticed a small problem and have been able to find a solution. Maybe I have just missed it.

I have noticed that all mods can change their forum access masks. Is there a simple way to change that without losing the setups now?

Please let me know.

Cheers,
GM

ron176
24 May 2003, 20:13
Great hack I have it working on V2.30 no problems at all :rambo:

Ecron Daemon
30 Jul 2004, 15:42
could anyone convert this for vb 3.0.3?

Ecron Daemon
17 Sep 2004, 12:44
Is it too hard to do that?!
The code already exist, I think it's relatively simple to adapt that for anyone of the coder inside here :)

gabs
19 Sep 2004, 10:30
Yes . it would rock to have this for 3.0.3

Ecron Daemon
19 Nov 2004, 19:45
help, I need only the conversion of this hack for vb 3.0.3

Digital_Madness
27 Jan 2005, 18:02
I am done with the admin panel of this hack but cannot figure out the perms for mod panel.. I will post the updated hack here once completed.

SilverBoy
28 Jul 2005, 09:00
is there any updates to let this great hack to work on vb3.0.7?

Perpetuum
01 Feb 2006, 17:01
Works for vBB 2.3.6! :nervous: