PDA

View Full Version : [RELEASE v2.x.x] Moderators Being able to control Accessmasks via MODCP


merk
09-08-2001, 10:00 PM
Description: Basically, this allows the moderator of a certain forum to add/take
access to users via access masks, however it only allows it if
the forum they moderate has that option enabled. It also
lists what users have access to a specified forum.

Please NOTE! If you dont use the Moderator Control Panel
(forum/mod/) Then this hack probably wont work, sorry!

Install:
Step1: First off, you will need phpMyAdmin, or something similar to add a column to the 'forum' database. I suggest you read > http://vbulletin.com/forum/showthread.php?s=&threadid=18558 for instructions on how to install it.

Once you get that installed, go to the forum table, and scroll down till you see 'Add new field :', put 1 in the box, choose 'At the end of the table' and click Go.

Call the field, 'allowmodaccess', its type, 'smallint' and size, '6'(all without quotes of course), then also choose default, and make it 0(zero)

Step2: Now comes the modding of forum.php in the AdminCP.

Find at approximatly Line 120

doformfooter("Save Forum");
}

// ###################### Start insert #######################


Replace With


//ADDED CODE
maketableheader("Moderator Accessmask Options");

makeyesnocode("Allow moderators of this forum to give/take access via the ModCP","modaccessmasks",0);
//UNADDED CODE
doformfooter("Save Forum");
}

// ###################### Start insert #######################


Then, Find at Approx 124ish

$DB_site->query("INSERT INTO forum
(forumid,styleid,title,description,active,displayo rder,parentid,
parentlist,allowposting,cancontainthreads,daysprun e,newpostemail,newthreademail,
moderatenew,allowhtml,allowbbcode,allowimages,allo wsmilies,allowicons,
styleoverride,allowratings,countposts,moderateatta ch,allowmodaccess)
VALUES
(NULL,'$styleset','".addslashes($title)."','".addslashes($description)."','$isactive','$displayorder','$parentid',
'','$allowposting','$cancontainthreads','$daysprun e','".addslashes($newpostemail)."','".addslashes($newthreademail)."',
'$moderatenew','$aallowhtmlcode','$aallowbbcode',' $aallowimgcode','$aallowsmilies','$aallowicons',
'$styleoverride','$allowratings','$countposts','$m oderateattach')");


Replace With


$DB_site->query("INSERT INTO forum
(forumid,styleid,title,description,active,displayo rder,parentid,
parentlist,allowposting,cancontainthreads,daysprun e,newpostemail,newthreademail,
moderatenew,allowhtml,allowbbcode,allowimages,allo wsmilies,allowicons,
styleoverride,allowratings,countposts,moderateatta ch,allowmodaccess)
VALUES
(NULL,'$styleset','".addslashes($title)."','".addslashes($description)."','$isactive','$displayorder','$parentid',
'','$allowposting','$cancontainthreads','$daysprun e','".addslashes($newpostemail)."','".addslashes($newthreademail)."',
'$moderatenew','$aallowhtmlcode','$aallowbbcode',' $aallowimgcode','$aallowsmilies','$aallowicons',
'$styleoverride','$allowratings','$countposts','$m oderateattach','$modaccessmasks')");


Then Find at Approx line 230

doformfooter("Save Changes");

}

// ###################### Start update #######################


Replace With


//ADDED CODE
maketableheader("Moderator Accessmask Options");

makeyesnocode("Allow moderators of this forum to give/take access via the ModCP","modaccessmasks",$forum[allowmodaccess]);
//UNADDED CODE

doformfooter("Save Changes");

}

// ###################### Start update #######################


Then Find at approx line 250


$DB_site->query("UPDATE forum
SET
styleid='$styleset', title='".addslashes($title)."', description='".addslashes($description)."',
active='$isactive', displayorder='$displayorder', parentid='$parentid', parentlist=$parentlist,
allowposting='$allowposting', cancontainthreads='$cancontainthreads', daysprune='$daysprune',
newpostemail='".addslashes($newpostemail)."', newthreademail='".addslashes($newthreademail)."',
moderatenew='$moderatenew', allowhtml='$aallowhtmlcode', allowbbcode='$aallowbbcode',
allowimages='$aallowimgcode', allowsmilies='$aallowsmilies', allowicons='$aallowicons',
styleoverride='$styleoverride', allowratings='$allowratings', countposts='$countposts',
moderateattach='$moderateattach'
WHERE forumid='$forumid'");


And replace with


$DB_site->query("UPDATE forum
SET
styleid='$styleset', title='".addslashes($title)."', description='".addslashes($description)."',
active='$isactive', displayorder='$displayorder', parentid='$parentid', parentlist=$parentlist,
allowposting='$allowposting', cancontainthreads='$cancontainthreads', daysprune='$daysprune',
newpostemail='".addslashes($newpostemail)."', newthreademail='".addslashes($newthreademail)."',
moderatenew='$moderatenew', allowhtml='$aallowhtmlcode', allowbbcode='$aallowbbcode',
allowimages='$aallowimgcode', allowsmilies='$aallowsmilies', allowicons='$aallowicons',
styleoverride='$styleoverride', allowratings='$allowratings', countposts='$countposts',
moderateattach='$moderateattach', allowmodaccess='$modaccessmasks'
WHERE forumid='$forumid'");


Step3: Now we need to modify index.php in the /mod/ folder.

Find at approx line 124

<!--<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="#3F3849"><td><font color="#BCB6CD">
<b>Styles</b>
</font></td></tr></table>
<a href="style.php?s=<?php echo $session[sessionhash]; ?>&action=modify"> Edit </a>
</td></tr>-->


Replace With


<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<?php maketableheader("User Access Masks"); ?>
</table>
<a href="modaccessmasks.php?s=<?php echo $session[sessionhash]; ?>&action=select"> Add | Edit | List </a>
</td></tr>


Step4: Making modaccessmasks.php...

Okay, this bit wont be easy :|

Basically, make this file as below, however, there are a few bits your going to have to grab from user.php in the admin directory.(which i will explain down furthur)


<?php
error_reporting(7);

require("./global.php");

cpheader();

if (isset($action)==0) {
$action="select";
}

//////////#########***********Here>><<>><< You need to add code i specifiy down furthur.

// ###################### Start Select Window Thing #####################
if ($action=="select"){

doformheader("modaccessmasks","editaccess");
makehiddencode("action","editaccess");
maketableheader("Access Granting For Forums","",0);
echo "<br>\n";
makeinputcode("User Name(exact)","user_name");

doformfooter("Edit User");
echo "<br>\n";
doformheader("modaccessmasks","editaccess");
makehiddencode("action","listusers");
maketableheader("List Users Access per Forum","",0);
echo "<br>\n";
makeinputcode("Forum ID","forumid");

doformfooter("List Forums");
}

// ################## Start List of Access per forum ##########

if ($action=="listusers") {
$query = "SELECT * FROM access ORDER BY userid";
$passthruquery=$DB_site->query($query);
while ($newsarray=$DB_site->fetch_array($passthruquery)) {
$query2 = "SELECT * FROM user WHERE userid=$newsarray[userid] LIMIT 1";
$query3 = "SELECT * FROM forum WHERE forumid=$newsarray[forumid] LIMIT 1";
$passthruquery2=$DB_site->query($query2);
$newsarray2=$DB_site->fetch_array($passthruquery2);
$passthruquery3=$DB_site->query($query3);
$newsarray3=$DB_site->fetch_array($passthruquery3);
if($newsarray[accessmask] == 1 AND $newsarray[forumid] == $forumid ) {
echo "$newsarray2[username] has access to $newsarray3[title]($newsarray[forumid])\n<br>";
}
}
}

cpfooter();
?>


Open up user.php And look around line 358 for

// ###################### Start Edit Access #######################

if ($action=="editaccess") {


And copy from there down to >> to approx line 425

echo "<p>User access updated successfully</p>";

$action="modify";
}


Put all that copy stuff into the above file, in the section thingo i specified.

Now you need to mod that code.

Step5: >>

Find

if ($action=="editaccess") {


Add immediatly below it


if(!isset($userid)) {
$username=$DB_site->query_first("SELECT userid FROM user WHERE username='$user_name'");
$userid=$username[userid];
}


Then Find

doformheader("user","updateaccess");
makehiddencode("userid","$userid");


Replace With


doformheader("modaccessmasks","updateaccess");
makehiddencode("userid","$userid");


I would recomend editing the below block of code, changing to description for your moderators.

echo "<tr class='firstalt'><td c.....


Now, find

maketableheader("Forum List");

$forumlist=$DB_site->query("SELECT * FROM forum");

Replace It with

maketableheader("Forum List");
///modified code
if($bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6) {
$forumlist=$DB_site->query("SELECT * FROM forum WHERE forum.allowmodaccess=1 ORDER BY forum.title");
}
else {
$forumlist=$DB_site->query("SELECT moderator.userid,forum.title FROM moderator,forum WHERE moderator.forumid=forum.forumid AND moderator.userid=$bbuserinfo[userid] AND forum.allowmodaccess=1 ORDER BY forum.title");
}
//end modify


And Finally,

Find

echo "<p>User access updated successfully</p>";

$action="modify";


And Replace with

echo "<p>User access updated successfully</p>";

$action="select";



Phew, you should be done. Now go into your AdminCP, and modify all the forums you wish your users to be able to change/add accessmasks to and at the bottom, choose 'yes' for allow mods to change access masks.

To access it, go to http://yourforum.url/forumpath/mod/ login, and hit the Add | Edit | View button on the menu.

Thats all Folks!

PS Phew for the 12345 char limit ;)

merk
09-09-2001, 03:05 AM
Sorry about the wrapping(or lack of it)

It took too long to write, so im not going to bother going thru it all and fix it all up :|

Hope you all enjoy it!

PS, there is no demo, unless someone is willing to set one up. But it works, my moderators are using it as we read this!

DarkReaper
09-09-2001, 03:09 AM
Yay! You think you could shove that in a text file though? :)

merk
09-09-2001, 03:12 AM
I didnt even think of that ;)

Too late now anyway :(

Oh well! :p

DarkReaper
09-09-2001, 03:21 AM
n/t

merk
09-09-2001, 03:33 AM
Thanks buddy

Pie'oh'pah
09-10-2001, 01:42 AM
Great man,

this is exactly the stuff, i was lookin 4

Running an Online Gaming Board its cool to give the mods of certain forums (mostly the 'Clanleaders') the possibility to add certain users (mostly 'Clanmembers' :D) to their internal forums.

Haven't installed it yet, but I guess this is it :D

-Alex

merk
09-10-2001, 03:27 AM
Thats exactly why i wrote it :)

Ive almost finished another one that allows them to modify the specific forum colours as well :D

merk
09-10-2001, 06:09 AM
ERROR IN HACK

I have found an error.

I have many moderators who do not reside in the moderator usergroup.

Expect a workaround in about 2/3 hours.

Sorry! (that means only supermods and admins and mods who still reside in the mod usergroup can see it)

Pie'oh'pah
09-10-2001, 04:15 PM
Hey,

are you in some kind of temporal flux??

Your timeline seems not to be the same as mine :D

-Alex

merk
09-11-2001, 10:55 AM
normal mods wouldnt see any forums, if they wernt in the moderator group, and even sometimes wouldnt show up at all.

simple SQL fix.

find

maketableheader("Forum List");
//MODIFIED CODE//
if($bbuserinfo[usergroupid]==7){
$forumlist=$DB_site->query("SELECT forum.*,moderator.userid,moderator.forumid FROM forum,moderator WHERE moderator.forumid=forum.forumid AND forum.allowmodaccess=1 AND moderator.userid=$bbuserinfo[userid] ORDER BY forum.title");
} elseif($bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6) {
$forumlist=$DB_site->query("SELECT * FROM forum WHERE forum.allowmodaccess=1 ORDER BY forum.title");
}

//UNMODIFIED CODE//


replace with


maketableheader("Forum List");
///modified code
if($bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6) {
$forumlist=$DB_site->query("SELECT * FROM forum WHERE forum.allowmodaccess=1 ORDER BY forum.title");
}
else {
$forumlist=$DB_site->query("SELECT moderator.userid,forum.title FROM moderator,forum WHERE moderator.forumid=forum.forumid AND moderator.userid=$bbuserinfo[userid] AND forum.allowmodaccess=1 ORDER BY forum.title");
}
//end modify

Pie'oh'pah
09-11-2001, 12:55 PM
Hi there,

thanx again for this hack.

There is one problem I have though:

The Option 'List Users Access per Forum' leads to a blank screen, while the 'Access Granting For Forums' Option works perfectly

Any hints?

-Alex

Pie'oh'pah
09-11-2001, 01:45 PM
And one more thing i noticed:

if a forum has subforums and the the moderator is only moderator of the subforums by inharitance, this mod will not be able to modify the subforums specifically.

-Alex

merk
09-12-2001, 07:36 AM
Good point, not that i really care about that much, it is a point.

If you want to go ahead and try and fix it, best bet would most probably be something along the lines of

looking for a forum with the forumid of XX, or looking for the forum with parentid CONTAINING XX. probably too complex for what i wrote the script for, but hey, if you want to fix it all up... ;)

Scott MacVicar
09-12-2001, 05:48 PM
I have been using a hack similar to this for the past couple of months. But I also have the edit access masks as part of the UserGroup Permissions.

The inheritance also works for my version. I would have to try and remember what I done as I never bothered documenting it when i done it.

If anyone wishes it I will post it.

DarkReaper
09-13-2001, 12:37 AM
Originally posted by PPN
I have been using a hack similar to this for the past couple of months. But I also have the edit access masks as part of the UserGroup Permissions.

The inheritance also works for my version. I would have to try and remember what I done as I never bothered documenting it when i done it.

If anyone wishes it I will post it.

Please post it! :)

The Prohacker
09-13-2001, 01:15 AM
I am reposting the text file, with the updated code, and I have added the sql query you should execute to create this field.....

merk
09-13-2001, 05:57 AM
Thanks heaps Prohacker.

I couldnt be bothered making one :)

Pie'oh'pah
09-15-2001, 03:53 PM
Originally posted by merk
Good point, not that i really care about that much, it is a point.

If you want to go ahead and try and fix it, best bet would most probably be something along the lines of

looking for a forum with the forumid of XX, or looking for the forum with parentid CONTAINING XX. probably too complex for what i wrote the script for, but hey, if you want to fix it all up... ;)

That is ok, man.

Regarding the other prob, displaying blank screen when 'List Users Access per Forum'.... anything??

-Alex

Scott MacVicar
09-15-2001, 06:06 PM
This is the version i have been using on my forums for past couple of months.

Editing access masks is added to the find feature within /mod/user.php it follows same principles as the ban mod features. People with admin and super mod privledges for the usergroup can edit all forum access masks.

If someone is a moderator by inheritance they can also edit all the forums they are entitled to.

Hope this helps some people.

DarkReaper
09-15-2001, 06:08 PM
swank. Installing...

DarkReaper
09-15-2001, 06:23 PM
A small problem I ran into during the install:


open /mod/user.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>

Upload all 3 files now and your done. Mods can now edit access masks for a user if their
usergroup has permission to and the forum allows them to.
and


It should be:


open /mod/index.php
---------------------------------------
on line 145 find

<a href="user.php?s=<?php echo $session[sessionhash]; ?>&action=find"> View </a> |

replace with

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

Upload all 4 files now and you're done. Mods can now edit access masks for a user if their
usergroup has permission to and the forum allows them to.

DarkReaper
09-15-2001, 07:04 PM
Didn't work. When they go to "Edit access masks" it says "you do not have permission to do this!"

Scott MacVicar
09-15-2001, 07:24 PM
Did you enable it for hte usergroup?

DarkReaper
09-15-2001, 07:53 PM
No, I enabled it for the forum itself.

I set the following option to "yes" for the forum:

Allow people who moderate this forum to remove user's access


Using usergroups for moderators is a pain, and it was removed from vB a few versions ago...

Scott MacVicar
09-15-2001, 07:57 PM
you need to enable it for the usergroup as well as the forum.

its a usergroup permission

DarkReaper
09-15-2001, 07:58 PM
Hm...if I enable it for "Registered" users, will all users then be able to do it? Or only those who are moderators of specific forums?

Scott MacVicar
09-15-2001, 10:11 PM
Nope, it wouldn't.

Cause of the
if (!$perms[ismoderator] and !$ismod=$DB_site->query_first("SELECT * FROM moderator WHERE userid=$bbuserinfo[userid]")) {
echo "<p>You do not have permission to do this!</p>";
exit;
}

stops people from doing this. its all throughout the mod control panel.

DarkReaper
09-16-2001, 04:07 AM
It still doesn't work. I've given the usergroup the user is in access to modify the access masks as well as specifying this in the forum settings and making him a moderator. It still says "You do not have permission to do this"

Scott MacVicar
09-16-2001, 10:33 AM
if your getting that error, you shouldn't be able to even do a search on someone as it uses the exact same code that is in searching, banning and viewing a user's details.

if (!$perms[ismoderator] and !$ismod=$DB_site->query_first("SELECT * FROM moderator WHERE userid=$bbuserinfo[userid]")) {
echo "<p>You do not have permission to do this!</p>";
exit;
}

Martz
09-16-2001, 04:25 PM
I have the same problem:

Usergroup enabled: Yes
Forum Enabled: Yes

"You do not have permission to do this" I've spent a few hours making sure everything you had said is correctly done, or at least I hope it is.

I also noticed the error at the end of the file which Darkreaper mentioned.

Thanks

DarkReaper
09-19-2001, 06:33 PM
Well..? Why isn't this working?

Scott MacVicar
09-19-2001, 08:44 PM
I recently formatted and install Win 2k, so sorry for not replying. I will try and install it on a fresh vbulletin and see if i get the same error. Hopefully I won't.

Last question, does your admin usergroup also have super moderator set to yes, as I'm presumming your testing this as the admin user.

DarkReaper
09-19-2001, 09:25 PM
I was testing using the account of a regular forum user who I had set to be able to do this.

Well...I just tested it with my account and it worked fine. You mentioned being a super moderator. Do I have to enable this for the person/category for it to work?

I think I remember you mentioning having a hack that allows moderators to be given the ability to change the styles for their forums. Do you? Or is that someone else?

merk
09-19-2001, 11:12 PM
This hack is for allowing moderators to give access to the forums they moderate(or take.)

The styles hack for moderators is coming, but its more complex, and im adding more options for control.

DarkReaper
09-20-2001, 02:16 AM
Originally posted by merk
This hack is for allowing moderators to give access to the forums they moderate(or take.)

The styles hack for moderators is coming, but its more complex, and im adding more options for control.

I was referring to PPN's version of the hack. :)

merk
09-20-2001, 02:44 AM
Ah, okay :D

Scott MacVicar
09-20-2001, 06:26 AM
No, the user only has to be a moderator of a forum and if they are also a super mod then they will show all forums. If you wish to enable it for people who are not moderators then it would involve editing of everything within the vBulletin mod panel.

Scott

DarkReaper
09-20-2001, 10:54 AM
I made the person a moderator, enabled it for his usergroup, and enabled it for his forum, and it still doesn't work.

DarkReaper
09-23-2001, 01:23 AM
if (!$perms[ismoderator] and !$ismod=$DB_site->query_first("SELECT * FROM moderator WHERE userid=$bbuserinfo[userid] AND (canbanusers=1 OR canviewprofile=1)")) {

Shouldn't something be done so you can throw a "OR caneditaccess=1" in there and make it work? As it is a user must have banning or profile viewing permissions for it to work.

Ashura
09-23-2001, 03:52 AM
I modified merk's version so it should inherit now by using PPN's version for the inheritance. This also changes the ability for Supermods and Admins to do any usergroup without special access required. No guarntees etc yada yada =)

Only real problem I currently see is maybe more than 2 layer inheritence could be an issue.

Here is the updated portion(s):

if ($action=="editaccess") {
if(!isset($userid)) {
$username=$DB_site->query_first("SELECT userid FROM user WHERE username='$user_name'");
$userid=$username[userid];
}
// New addition - Get permissions
$perms=getpermissions();
// End New

-- Remove Merk's // Modify Code section
-- Replace beginning from where that section was to be inserted at until these lines

doformfooter("Save Changes");
}


This is what to replace with:

// NEW modify
$accesslist=$DB_site->query("SELECT * FROM access WHERE userid='$userid'");
while ($access=$DB_site->fetch_array($accesslist)) {
$accessarray["$access[forumid]"] = $access;
}

$modlist=$DB_site->query("SELECT * FROM moderator WHERE
userid='$bbuserinfo[userid]'");
while ($mod=$DB_site->fetch_array($modlist)) {
$modarray["$mod[forumid]"] = $mod;
$i++;
}

$forumlist=$DB_site->query("SELECT * from forum ORDER BY forum.title");
while($forum=$DB_site->fetch_array($forumlist)) {
if ( is_array($accessarray["$forum[forumid]"]) ) {
if ($accessarray["$forum[forumid]"]['accessmask']==0) {
$sel = 0;
} else if ($accessarray["$forum[forumid]"]['accessmask']==1) {
$sel = 1;
} else {
$sel = -1;
}
} else {
$sel = -1;
}
if(($modarray["$forum[forumid]"] || $modarray["$forum[forumid]"] ||
$perms['ismoderator'] && $forum['allowmodaccess']) ||
$perms['cancontrolpanel']) {
echo "<tr class='secondalt'><td nowrap><P>$forum[title]</p></td><td width=100%><p>";
echo "<input type=\"radio\" name=\"accessupdate[".$forum['forumid']."]\" value=\"1\"".iif($sel
==1,"checked","")."> Yes <input type=\"radio\" name=\"accessupdate[".$forum['forumid']."]\" value=
\"0\"".iif($sel==0,"checked","")."> No <input type=\"radio\" name=\"accessupdate[".$forum['forumid
']."]\" value=\"-1\" ".iif($sel==-1,"checked","")."> Default <input type=\"hidden\" name=\"oldcach
e[".$forum['forumid']."]\" value=\"$sel\">";
echo "</p></td></tr>\n";
}
}

DarkReaper
09-23-2001, 03:55 AM
Uh...would you mind making those instructions a bit more clear? :)

DarkReaper
09-23-2001, 04:03 AM
nm, I'm just tired.

Something's not working right with that.

Forum1
--forum2
----forum3

I have them as a moderator of forum1, but set it so they can't edit permissions for that. They can edit permissions for 2 and 3. It only lets them edit forum1's permissions though...

Ashura
09-23-2001, 05:23 AM
Ok updated for what should be complete inheritance and some redundant code removed :)

These are the steps for editing the code pasted from user.php in Merk's instructions (step 5). So just replace step5 with this and inheritance should go through as many children as possible. With some slight changes this would also work for PPN's code too i believe since it suffers from the same problem of not inheriting past the first parent forum.

Find

if ($action=="editaccess") {


Add immediately below it

if(!isset($userid)) {
$username=$DB_site->query_first("SELECT userid FROM user WHERE username='$user_name'");
$userid=$username[userid];
}
$user=$DB_site->query_first("SELECT username FROM user WHERE userid='$userid'");

$accesslist=$DB_site->query("SELECT * FROM access WHERE userid='$userid'");
while ($access=$DB_site->fetch_array($accesslist)) {
$accessarray["$access[forumid]"] = $access;
}
$DB_site->free_result($accesslist);


Find

doformheader("user","updateaccess");
makehiddencode("userid","$userid");


Replace with

doformheader("modaccessmasks","updateaccess");
makehiddencode("userid","$userid");


Edit the html section just after this to your liking if you wish for your moderators.

Find

while($forum=$DB_site->fetch_array($forumlist)) {
echo "<tr class='secondalt'><td nowrap><P>$forum[title]</p></td><td width=100%><p>";
if ( is_array($accessarray["$forum[forumid]"]) ) {


Change too (This makes sure not all forums are displayed just ones they have access too).

while($forum=$DB_site->fetch_array($forumlist)) {
if ( is_array($accessarray["$forum[forumid]"]) ) {


Find

echo "<input type=\"radio\" name=\"accessupdate[".$forum['forumid']."]\" value=\"1\"".iif($sel
==1,"checked","")."> Yes <input type=\"radio\" name=\"accessupdate[".$forum['forumid']."]\" value=
\"0\"".iif($sel==0,"checked","")."> No <input type=\"radio\" name=\"accessupdate[".$forum['forumid
']."]\" value=\"-1\" ".iif($sel==-1,"checked","")."> Default <input type=\"hidden\" name=\"oldcach
e[".$forum['forumid']."]\" value=\"$sel\">";
echo "</p></td></tr>\n";
}


Replace with

$perms=getpermissions($forumid,-1,-1,$forum[parentlist]);
if(( ismoderator($forum[forumid],"canmoderateposts") ||
$perms['ismoderator'] && $forum['allowmodaccess']) ||
$perms['cancontrolpanel']) {
echo "<tr class='secondalt'><td nowrap><P>$forum[title]</p></td><td width=100%><p>";
echo "<input type=\"radio\" name=\"accessupdate[".$forum['forumid']."]\" value=\"1\"".iif($sel
==1,"checked","")."> Yes <input type=\"radio\" name=\"accessupdate[".$forum['forumid']."]\" value=
\"0\"".iif($sel==0,"checked","")."> No <input type=\"radio\" name=\"accessupdate[".$forum['forumid
']."]\" value=\"-1\" ".iif($sel==-1,"checked","")."> Default <input type=\"hidden\" name=\"oldcach
e[".$forum['forumid']."]\" value=\"$sel\">";
echo "</p></td></tr>\n";
}
}


Find

echo "<p>User access updated successfully</p>";
$action="modify";


Replace with

echo "<p>User access updated successfully</p>";
$action="select";


And your done!!

These directions hopefully are more clear

DarkReaper
09-23-2001, 05:40 AM
Didn't work...when I ran it I got the blank page...something's not right! :(

Ashura
09-23-2001, 05:44 AM
Oh your using PPN's version of the hack :) let me load that up and post the changes for it! =)

DarkReaper
09-23-2001, 05:45 AM
No, I'm using merk's....

Ashura
09-23-2001, 05:54 AM
Are you logged in as the Admin when accessing the mod panel?

If so you should get a listing of all forums when you click on Edit user (either blank or a specific users name entered in).

If your logged in as a normal Mod, did you set all the forums to allow Moderator access mask modification? This part of it is not inherited the "if they are a moderator" is inherited.

DarkReaper
09-23-2001, 05:57 AM
It doesn't matter what I'm logged in as...by blank page I mean the script is broken. There's an error in it somewhere. Check your PM box.

merk
09-23-2001, 06:01 AM
Thanks heaps Ashura!

DarkReaper
09-23-2001, 06:10 AM
Ok, it almost works now. Inheritence works, but they can edit it on forums they're should be able to.

Forum1
--forum2
----forum3

I have them as a moderator of forum1, but set it so they can't edit permissions for that. They can edit permissions for 2 and 3. It lets them edit permissions for both 1, 2, and 3...

Ashura
09-23-2001, 06:22 AM
Oops my bad =)

Change this

if(( ismoderator($forum[forumid],"canmoderateposts") ||
$perms['ismoderator'] && $forum['allowmodaccess']) ||
$perms['cancontrolpanel'])


To

if(( (ismoderator($forum[forumid],"canmoderateposts") ||
$perms['ismoderator']) && $forum['allowmodaccess']) ||
$perms['cancontrolpanel']) {


Needed a set of ()'s around the stuff before the && and that should work for you :)

DarkReaper
09-23-2001, 06:25 AM
Works just fine now :)

Would it be possible to have a hierarchial list of all the forums they can modify instead of having them enter the forum id?

Ashura
09-23-2001, 06:35 AM
Gimme a few also going to make sure it doesn't allow things we don't want it to do either. =)

merk
09-23-2001, 06:43 AM
You mean, get a list of forums for the second form i made?

that gives a list of all the people who have access masks listed?

Tweezy stuff there! :)

Something along the lines of>

function getchildren($parentid=-1)
{ global $DB_site, $bbuserinfo;

$childquery = "SELECT title,forumid,styleid,parentid ";
$childquery .= "FROM forum ";
$childquery .= "WHERE parentid=$parentid ";
$childquery .= "ORDER BY displayorder";
$childtemp=$DB_site->query($childquery);
print("<ul>");
while ($children=$DB_site->fetch_array($childtemp)) {

$accesscheckquery="SELECT * FROM moderator WHERE userid=$bbuserinfo[userid] AND forumid=$children[forumid]";
$accesstemp=$DB_site->query($accesscheckquery);
while($accesscheck=$DB_site->fetch_array($accesstemp)) {
$modcheck[$accesscheck[forumid]]=$accesscheck;
}
if($modcheck[$children[forumid]][caneditstyles]>=1){ $colour="red"; } else { $colour="blue"; }
$canedit=$modcheck[$children[forumid]][caneditstyles];
print("<li><font style=\"color:$colour\">$children[forumid]-$children[title], $children[parentid]--$canedit</font></li>");

getchildren($children[forumid]);
}
print("</ul>");
}


I wrote this, to get a list, and if they have caneditstyles=1, show it in red, else blue.

Just adapt the 'while' loop to check to see if they have moderator and the forum is caneditaccess=1

Shouldnt be too hard :)

Ashura
09-23-2001, 08:39 AM
Update
- added some more checks just to make sure they have access (just like other mod panel functions do)
- added a check in edit so ONLY admin's can edit access of Super Mods and Admin's (just to be paranoid)
- Added 'forums' list if you hit list forums without a Forum ID

May need some more cleaning up but should work fine

Here is my current version of this file (Pretty sure we can post these as attachments).

Scott MacVicar
09-23-2001, 08:40 AM
i released a working version under a different thread, and i sorted the inheritance to be more than one level.

http://vbulletin.com/forum/showthread.php?s=&threadid=28654

i also knew what i had done wrong in this version but its too much to fix XD

maverick1236
09-30-2001, 04:14 AM
Parse error: parse error in c:\program files\nusphere\apache\htdocs\upload\mod\user.php on line 71

no idea
everything looks ok

??

mcncyo
10-08-2001, 08:35 AM
When i try to update a user permssion i get a blank screen and it doesn't update. Does anyone know why this is happenning?

Ashura
10-08-2001, 09:25 AM
For which version? Merk's or PPN's :)

mcncyo
10-08-2001, 09:28 AM
Merks

merk
10-08-2001, 09:49 AM
Somehow mine isnt working properly, even after my tests, i found no errors.

If you can wait about a week, i will have version2 out, which will hopefully work alot better(and the instructions will be alot better)

Ashura
10-08-2001, 09:49 AM
Is this using my additions to the hack?

If so, is the user an Admin or Super Mod ( usergroupid 5 or 6)?

Is the account your trying to edit with a Moderator of the forum or any of its parents, Admin, or Super Mod?

Need a bit more to go on here.

Ashura
10-08-2001, 09:55 AM
This can happen in forums where you have not enabled the feature for the Forum in the Admin CP. The ability to edit it is not derived from parent forums.

I get a blank page when listing forums and selecting one that I have not explicitly given Mods access to edit.

Zeoran
10-10-2001, 06:41 PM
I have a request simliar to this. I need my moderators to be able to change the users profile options (namely user title and group). The default is that they can view it, but they can't change it. Are there any hacks out there that would allow them to edit the information too? I could really use this so I can stop having them have access to the main admin cp panel.

TIA

Scott MacVicar
10-10-2001, 09:32 PM
[QUOTE]Originally posted by PPN
i released a working version under a different thread, and i sorted the inheritance to be more than one level.

http://vbulletin.com/forum/showthread.php?s=&threadid=28654

i also knew what i had done wrong in this version but its too much to fix XD

merk
10-10-2001, 10:52 PM
Originally posted by Zeoran
I have a request simliar to this. I need my moderators to be able to change the users profile options (namely user title and group). The default is that they can view it, but they can't change it. Are there any hacks out there that would allow them to edit the information too? I could really use this so I can stop having them have access to the main admin cp panel.

TIA

Try the requests forum.

Zeoran
10-11-2001, 09:23 PM
I did... no luck so far. :(

Originally posted by merk


Try the requests forum.

dieKetzer
05-07-2002, 09:20 AM
Please I hope this works for 2.2.5