Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-10-2007, 02:26 AM
ice chrono ice chrono is offline
 
Join Date: Jul 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 09-10-2007, 04:28 AM
G0F0RBR0KE G0F0RBR0KE is offline
 
Join Date: Mar 2005
Posts: 987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I do hope someone can accomplish this.
Reply With Quote
  #3  
Old 09-10-2007, 09:24 AM
FullyTested FullyTested is offline
 
Join Date: Aug 2007
Posts: 163
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'], -1, PREG_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.
Reply With Quote
  #4  
Old 09-10-2007, 03:40 PM
ice chrono ice chrono is offline
 
Join Date: Jul 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I really it to not let them delete thread if made by higher user.
Reply With Quote
  #5  
Old 09-10-2007, 04:06 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This already exists.

https://vborg.vbsupport.ru/showthread.php?t=98737
Reply With Quote
  #6  
Old 09-10-2007, 05:09 PM
ice chrono ice chrono is offline
 
Join Date: Jul 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you linked me to the 3.5 version :P
but im trying out the 3.6 right now.
Reply With Quote
  #7  
Old 09-16-2007, 01:13 AM
ice chrono ice chrono is offline
 
Join Date: Jul 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it did not work. my mods are editing smods and so on.
i just need a simple mod
Reply With Quote
  #8  
Old 09-17-2007, 01:28 AM
DocBenny DocBenny is offline
 
Join Date: Oct 2005
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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. ??
Reply With Quote
  #9  
Old 12-23-2007, 06:11 PM
dommo_g dommo_g is offline
 
Join Date: May 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bumping this....any way to do this yet?
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 02:34 PM.


Powered by vBulletin® Version 3.9.0 Beta 2
Copyright ©2000 - 2017, vBulletin Solutions Inc.