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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-10-2007, 03: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, 05: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, 10: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'], -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.
Reply With Quote
  #4  
Old 09-10-2007, 04: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, 05: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, 06: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, 02: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, 02: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 03:09 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05485 seconds
  • Memory Usage 2,278KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete