vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Administrative and Maintenance Tools - Give Moderators ModCP Link In Footer (https://vborg.vbsupport.ru/showthread.php?t=320760)

Pakblogger 11-10-2015 10:00 PM

Give Moderators ModCP Link In Footer
 
1 Attachment(s)
I have many manual created moderators groups, just today one of my moderator asked me that modcp option is not showing for him,.

There is small template modification in footer template for the same.

Template Edit (1)

In Template "footer", find:


PHP Code:

if condition="$show['modcplink']"


Replace With:

PHP Code:

if condition="can_moderate()"

Thats all,..

100% working checked on Vbulletin 4.2.3

Zachery 11-12-2015 12:15 AM

Welcome to 1 extra query per page view for every non moderator/admin on your site!

Why do you think it was changed in the first place? :)

Pakblogger 11-12-2015 04:13 AM

Quote:

Originally Posted by Zachery (Post 2558615)
Welcome to 1 extra query per page view for every non moderator/admin on your site!

Why do you think it was changed in the first place? :)

Can you explain what you want to say

Alan_SP 11-12-2015 08:12 PM

That your site would work a bit slower (every query slow down website a bit).

On the other hand, this is always a question do you need functionality and if you do, how much do you need it. Also, depending on how popular your site is, you maybe wouldn't even notice this.

Zachery 11-12-2015 09:02 PM

vBulletin originally used the can_moderate() check in the show modcp link, but removed it because it caused an extra query on every page that was viewed for any user who was not a admin/mod

If you have 1000 hits per hour, and only 10 of those are from staff, you ran an extra 990 queries, for no real reason.

Pakblogger 11-13-2015 04:01 PM

Quote:

Originally Posted by Alan_SP (Post 2558647)
That your site would work a bit slower (every query slow down website a bit).

On the other hand, this is always a question do you need functionality and if you do, how much do you need it. Also, depending on how popular your site is, you maybe wouldn't even notice this.

Quote:

Originally Posted by Zachery (Post 2558651)
vBulletin originally used the can_moderate() check in the show modcp link, but removed it because it caused an extra query on every page that was viewed for any user who was not a admin/mod

If you have 1000 hits per hour, and only 10 of those are from staff, you ran an extra 990 queries, for no real reason.

100% correct

alcazarx 11-13-2015 06:58 PM

We use a modified version of the call
Code:

// This generates an extra query for non-admins/supermods on many pages so we have chosen to only display it to supermods & admins
// $show['modcplink'] = iif(can_moderate(), true, false);
$show['modcplink'] = (
                $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']
                OR $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator']
                OR is_member_of($vbulletin->userinfo,7)
);

Group #7 is the standard Moderators group which contains all users that are declared as moderator.
Would this also generate extra queries?
Thanks.

Alan_SP 11-14-2015 03:10 PM

Basically, you only need conditionals before can_moderate if user is moderator (member of usergroup 7, or others if you use different usergroup settings). Other checks you don't need, as supermods and admins already can see that link.

And no, in that case, if check returns false, code within check is skipped, so no additional queries.

Zachery 11-15-2015 10:42 PM

Can't assume users who are in a specific usergroup are even moderators.

Paul M 11-16-2015 10:34 AM

While its true this will add an extra query, in reality these days its not that big a deal.

Unless you sql server is on the brink of collapse (in which case you have for more serious issues than this mod) then you really are never going to notice the difference.


All times are GMT. The time now is 02:05 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.01156 seconds
  • Memory Usage 1,738KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete