vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Message Editing Hierarchy for 3.6 (https://vborg.vbsupport.ru/showthread.php?t=157450)

ice chrono 09-10-2007 03:26 AM

Message Editing Hierarchy for 3.6
 
looking for a mod to prevent moderators from editing users in a higher class.
basically
Mods>S-mods>Admins>S-Admins
s-mods can edit mods post.. but can not touch Admins and S-Admins post/topics.
and thanks in advance :D

G0F0RBR0KE 09-10-2007 05:28 AM

I do hope someone can accomplish this.

FullyTested 09-10-2007 10:24 AM

While this is definitely not of plugin quality, it is a quick fix to the hierarchy post edit issue.
Please note that a moderator can still edit and/or delete the thread itself.
In addition, moderators that are not assigned a forum do not count as privileged to edit posts.
I did write this quickly, so unlike my username, I haven't fully tested it. Use at your own discretion.

1). Copy and paste the following function at the end of the functions.php file:
PHP Code:

// note: moderator usergroup only counts if user is assigned to a forum
function caneditposter($userid)
{
    global 
$vbulletin;
    static 
$superadmins;

    
$issuperadmin false;
    
$issuperadmin2 false;
    
$isadmin false;
    
$isadmin2 false;
    
$issupermod false;
    
$issupermod2 false;
    
$ismod false;
    
$ismod2 false;

    if (
$userid == $vbulletin->userinfo['userid'])
        return 
true;
        
    if (!
is_array($superadmins))
    {
        
$superadmins preg_split('#\s*,\s*#s'$vbulletin->config['SpecialUsers']['superadministrators'], -1PREG_SPLIT_NO_EMPTY);
    }
    
    if (
$vbulletin->userinfo['userid'] < 1)
    {
        
// user is a guest
        
return false;
    }
    else if (
in_array($vbulletin->userinfo['userid'], $superadmins))
    {
        
// user is a super administrator (defined in config.php) so can do anything
        
$issuperadmin true;
    }
    else if ((
$vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
    {
        
$isadmin true;
    }

    
    if (
$userid 1)
    {
        
// user is a guest
        
return true;
    }
    
    
$userinfo fetch_userinfo($userid);
    
    if (
in_array($userid$superadmins))
    {
        
// user is a super administrator (defined in config.php) so can do anything
        
$issuperadmin2 true;
    }
    else if (
$userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])
    {
        
$isadmin2 true;
    }
    
        
    if (
$vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'])
    {
        
$issupermod true;
    }
    
    if (
$userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'])
    {
        
$issupermod2 true;
    }

    if (!
$issupermod)
    {
        
$mod $vbulletin->db->query_first_slave("
                SELECT forumid
                FROM " 
TABLE_PREFIX "moderator
                WHERE userid = " 
$vbulletin->userinfo['userid'] . "
                LIMIT 1
        "
);
        if (
$mod)
            
$ismod true;
    }
        
    if (!
$issupermod2)
    {
        
$mod2 $vbulletin->db->query_first("
            SELECT forumid
            FROM " 
TABLE_PREFIX "moderator
            WHERE userid = 
$userid
            LIMIT 1
        "
);
        if (
$mod2)
            
$ismod2 true;
    }



    if (
$issuperadmin)
    {
        if (
$issuperadmin2)
            return 
false;
        else
            return 
true;
    }
    else if (
$isadmin)
    {
        if (
$issuperadmin2 OR $isadmin2)
            return 
false;
        else
            return 
true;
    }
    else if (
$issupermod)
    {
        if (
$issuperadmin2 OR $isadmin2 OR $issupermod2)
            return 
false;
        else
            return 
true;
    }
    else if (
$ismod)
    {
        if (
$issuperadmin2 OR $isadmin2 OR $issupermod2 OR $ismod2)
            return 
false;
        else
            return 
true;
    }
    
    return 
false;


2). Locate the hook 'postbit_display_complete' in class_postbit.php and paste the following:
PHP Code:

if ($this->post['editlink'] AND !caneditposter($this->post['userid']))
{
    
$this->post['editlink'] = '';
    
$show['ajax_js'] = false;


3). Locate 'verify_forum_password' in editpost.php and paste the following:
PHP Code:

if (!caneditposter($postinfo['userid']))
    
print_no_permission(); 

4). Done!


Cheers,
FullyTested.

ice chrono 09-10-2007 04:40 PM

I really it to not let them delete thread if made by higher user.

Paul M 09-10-2007 05:06 PM

This already exists.

https://vborg.vbsupport.ru/showthread.php?t=98737

ice chrono 09-10-2007 06:09 PM

you linked me to the 3.5 version :P
but im trying out the 3.6 right now.

ice chrono 09-16-2007 02:13 AM

it did not work. my mods are editing smods and so on.
i just need a simple mod :(

DocBenny 09-17-2007 02:28 AM

Yes we need one for versions 3.6x, the 3.5x were working but they do not work on the 3.6x. Can someone please update this. ??

dommo_g 12-23-2007 06:11 PM

bumping this....any way to do this yet?


All times are GMT. The time now is 11:21 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.01178 seconds
  • Memory Usage 1,768KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete