Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Give Moderators ModCP Link In Footer Details »»
Give Moderators ModCP Link In Footer
Version: 1.00, by Pakblogger Pakblogger is offline
Developer Last Online: Mar 2021 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 4.2.3 Rating:
Released: 11-10-2015 Last Update: Never Installs: 3
Template Edits
Re-useable Code Translations  
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
Alan_SP

Comments
  #2  
Old 11-12-2015, 12:15 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #3  
Old 11-12-2015, 04:13 AM
Pakblogger Pakblogger is offline
 
Join Date: Oct 2009
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
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
Reply With Quote
  #4  
Old 11-12-2015, 08:12 PM
Alan_SP's Avatar
Alan_SP Alan_SP is offline
 
Join Date: Nov 2009
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 11-12-2015, 09:02 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 11-13-2015, 04:01 PM
Pakblogger Pakblogger is offline
 
Join Date: Oct 2009
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Alan_SP View Post
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 View Post
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
Reply With Quote
  #7  
Old 11-13-2015, 06:58 PM
alcazarx's Avatar
alcazarx alcazarx is offline
 
Join Date: Jul 2014
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Благодарность от:
Alan_SP
  #8  
Old 11-14-2015, 03:10 PM
Alan_SP's Avatar
Alan_SP Alan_SP is offline
 
Join Date: Nov 2009
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 11-15-2015, 10:42 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can't assume users who are in a specific usergroup are even moderators.
Reply With Quote
  #10  
Old 11-16-2015, 10:34 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Благодарность от:
akz645
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 07:48 PM.


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.07749 seconds
  • Memory Usage 2,319KB
  • Queries Executed 26 (?)
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)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (3)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • 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