vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   [RELEASE v2.x.x] Moderators Being able to control Accessmasks via MODCP (https://vborg.vbsupport.ru/showthread.php?t=27724)

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):
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";
  }



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
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

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!


All times are GMT. The time now is 06:54 AM.

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.02263 seconds
  • Memory Usage 1,805KB
  • 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
  • (13)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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