Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by merk merk is offline
Developer Last Online: Mar 2012 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 09-08-2001 Last Update: Never Installs: 2
 
No support by the author.

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/showthrea...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
PHP Code:
  doformfooter("Save Forum");
}

// ###################### Start insert ####################### 
Replace With

PHP Code:
  //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
PHP Code:
  $DB_site->query("INSERT INTO forum
                      (forumid,styleid,title,description,active,displayorder,parentid,
                       parentlist,allowposting,cancontainthreads,daysprune,newpostemail,newthreademail,
                       moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
                       styleoverride,allowratings,countposts,moderateattach,allowmodaccess)
                   VALUES
                      (NULL,'
$styleset','".addslashes($title)."','".addslashes($description)."','$isactive','$displayorder','$parentid',
                       '','
$allowposting','$cancontainthreads','$daysprune','".addslashes($newpostemail)."','".addslashes($newthreademail)."',
                       '
$moderatenew','$aallowhtmlcode','$aallowbbcode','$aallowimgcode','$aallowsmilies','$aallowicons',
                       '
$styleoverride','$allowratings','$countposts','$moderateattach')"); 
Replace With

PHP Code:
  $DB_site->query("INSERT INTO forum
                      (forumid,styleid,title,description,active,displayorder,parentid,
                       parentlist,allowposting,cancontainthreads,daysprune,newpostemail,newthreademail,
                       moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
                       styleoverride,allowratings,countposts,moderateattach,allowmodaccess)
                   VALUES
                      (NULL,'
$styleset','".addslashes($title)."','".addslashes($description)."','$isactive','$displayorder','$parentid',
                       '','
$allowposting','$cancontainthreads','$daysprune','".addslashes($newpostemail)."','".addslashes($newthreademail)."',
                       '
$moderatenew','$aallowhtmlcode','$aallowbbcode','$aallowimgcode','$aallowsmilies','$aallowicons',
                       '
$styleoverride','$allowratings','$countposts','$moderateattach','$modaccessmasks')"); 
Then Find at Approx line 230
PHP Code:
  doformfooter("Save Changes");

}

// ###################### Start update ####################### 
Replace With

PHP Code:
  //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

PHP Code:
  $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

PHP Code:
  $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
PHP Code:
<!--<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

PHP Code:
<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 Code:
<?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] == 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
PHP Code:
// ###################### Start Edit Access #######################

if ($action=="editaccess") { 
And copy from there down to >> to approx line 425
PHP Code:
  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
PHP Code:
if ($action=="editaccess") { 
Add immediatly below it

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

Then Find
PHP Code:
  doformheader("user","updateaccess");
  
makehiddencode("userid","$userid"); 
Replace With

PHP Code:
  doformheader("modaccessmasks","updateaccess");
  
makehiddencode("userid","$userid"); 
I would recomend editing the below block of code, changing to description for your moderators.
PHP Code:
echo "<tr class='firstalt'><td c..... 
Now, find
PHP Code:
  maketableheader("Forum List");

  
$forumlist=$DB_site->query("SELECT * FROM forum"); 
Replace It with
PHP Code:
  maketableheader("Forum List");
///modified code
if($bbuserinfo[usergroupid]==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
PHP Code:
  echo "<p>User access updated successfully</p>";

  
$action="modify"
And Replace with
PHP Code:
  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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 09-23-2001, 03:52 AM
Ashura Ashura is offline
 
Join Date: Nov 2001
Location: In a Box
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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):
PHP Code:
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
PHP Code:
  doformfooter("Save Changes");

This is what to replace with:
PHP Code:
// 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";
  }

Reply With Quote
  #43  
Old 09-23-2001, 03:55 AM
DarkReaper DarkReaper is offline
 
Join Date: Oct 2001
Posts: 429
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Uh...would you mind making those instructions a bit more clear?
Reply With Quote
  #44  
Old 09-23-2001, 04:03 AM
DarkReaper DarkReaper is offline
 
Join Date: Oct 2001
Posts: 429
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #45  
Old 09-23-2001, 05:23 AM
Ashura Ashura is offline
 
Join Date: Nov 2001
Location: In a Box
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
PHP Code:
if ($action=="editaccess") { 
Add immediately below it
PHP Code:
  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
PHP Code:
doformheader("user","updateaccess");
makehiddencode("userid","$userid"); 
Replace with
PHP Code:
doformheader("modaccessmasks","updateaccess");
makehiddencode("userid","$userid"); 
Edit the html section just after this to your liking if you wish for your moderators.

Find
PHP Code:
  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).
PHP Code:
  while($forum=$DB_site->fetch_array($forumlist)) {
    if ( 
is_array($accessarray["$forum[forumid]"]) ) { 
Find
PHP Code:
    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
PHP Code:
    $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
PHP Code:
echo "<p>User access updated successfully</p>";
$action="modify"
Replace with
PHP Code:
echo "<p>User access updated successfully</p>";
$action="select"
And your done!!

These directions hopefully are more clear
Reply With Quote
  #46  
Old 09-23-2001, 05:40 AM
DarkReaper DarkReaper is offline
 
Join Date: Oct 2001
Posts: 429
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Didn't work...when I ran it I got the blank page...something's not right!
Reply With Quote
  #47  
Old 09-23-2001, 05:44 AM
Ashura Ashura is offline
 
Join Date: Nov 2001
Location: In a Box
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh your using PPN's version of the hack let me load that up and post the changes for it! =)
Reply With Quote
  #48  
Old 09-23-2001, 05:45 AM
DarkReaper DarkReaper is offline
 
Join Date: Oct 2001
Posts: 429
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, I'm using merk's....
Reply With Quote
  #49  
Old 09-23-2001, 05:54 AM
Ashura Ashura is offline
 
Join Date: Nov 2001
Location: In a Box
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #50  
Old 09-23-2001, 05:57 AM
DarkReaper DarkReaper is offline
 
Join Date: Oct 2001
Posts: 429
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #51  
Old 09-23-2001, 06:01 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks heaps Ashura!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:25 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.04749 seconds
  • Memory Usage 2,475KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (35)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete