Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 12-11-2008, 11:40 PM
Sharron Sharron is offline
 
Join Date: Oct 2007
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Users online for mods/admins only

We runa very busy board and the users online is in excess of 1,000 much of the time. This has an effect on performance and since the users online is not essential to members they don't need it so it's on of the things we are looking to remove from members.

However, the staff of the board do need it.

I can hide the display of the users online from members easily enough such that it shows only to mods and admins but of course the query still runs and so this offers no performance benefit.

So, I need to be able to set it so that the query to get the users online only actually runs when a mod or admin opens the forum index, and not run at all when a normal member opens the page which isn't a template job.

Anybody have any ideas where and how this would be acheived?
Reply With Quote
  #2  
Old 12-12-2008, 02:09 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's the line you want to change in the code:
PHP Code:
// ### LOGGED IN USERS #################################################
$activeusers '';
if ((
$vbulletin->options['displayloggedin'] == OR $vbulletin->options['displayloggedin'] == OR ($vbulletin->options['displayloggedin'] > AND $vbulletin->userinfo['userid'])) AND !$show['search_engine'])

You can just turn the option off in vboptions > forum home page > display logged in users (displayloggedin will equal 0) and then add into the first condition "OR is_member_of($bbuserinfo,5,6,7)" - 5,6,7 being the mods, admins, and supermods. You can modify the usergroups as you want.
Reply With Quote
  #3  
Old 12-12-2008, 08:07 AM
Sharron Sharron is offline
 
Join Date: Oct 2007
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you.

I found the line of code but no matter where I put the new OR clause it makes no difference - if display is turned off in forum home page options then nobody sees the who's online, if it turned on then everyone sees the who's online.

I confess it is early in the morning for me and I've had 3 hours sleep so I may be missing something but any help would be much appreciatted.
Reply With Quote
  #4  
Old 12-12-2008, 08:17 AM
Mosh's Avatar
Mosh Mosh is offline
 
Join Date: Aug 2004
Location: Melbourne, Australia
Posts: 1,968
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Sharron View Post
Thank you.

I found the line of code but no matter where I put the new OR clause it makes no difference - if display is turned off in forum home page options then nobody sees the who's online, if it turned on then everyone sees the who's online.

I confess it is early in the morning for me and I've had 3 hours sleep so I may be missing something but any help would be much appreciatted.
Try changing the OR to an AND, putting it at the end of the conditional, and leave the display logged in users set to on, that should force $show['loggedinusers'] to be false and not run the query.

i.e

PHP Code:
// ### LOGGED IN USERS #################################################
$activeusers '';
if ((
$vbulletin->options['displayloggedin'] == OR $vbulletin->options['displayloggedin'] == OR ($vbulletin->options['displayloggedin'] > AND $vbulletin->userinfo['userid'])) AND !$show['search_engine'] AND is_member_of($bbuserinfo,5,6,7))

Reply With Quote
  #5  
Old 12-12-2008, 08:38 AM
Sharron Sharron is offline
 
Join Date: Oct 2007
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's still the same.

I think it may be because I am not sure where to actually put the new bit though to be honest. I've tried it everywhere. If it's here
Code:
if (($vbulletin->options['displayloggedin'] == 1 OR $vbulletin->options['displayloggedin'] == 2  AND is_member_of($bbuserinfo,5,6,7) OR ($vbulletin->options['displayloggedin'] > 2 AND $vbulletin->userinfo['userid']))  AND !$show['search_engine'])
the page just follows the vboptions setting - either all see it or no-one sees it.

put it here
Code:
if (($vbulletin->options['displayloggedin'] == 1 OR $vbulletin->options['displayloggedin'] == 2  OR ($vbulletin->options['displayloggedin'] > 2 AND $vbulletin->userinfo['userid']) AND is_member_of($bbuserinfo,5,6,7))  AND !$show['search_engine'])
the same

here
Code:
if (($vbulletin->options['displayloggedin'] == 1 OR $vbulletin->options['displayloggedin'] == 2  OR ($vbulletin->options['displayloggedin'] > 2 AND $vbulletin->userinfo['userid'])) AND is_member_of($bbuserinfo,5,6,7)  AND !$show['search_engine'])
and nobody sees it at all even if it is switched on in options

I must be doing something wrong some where.
Reply With Quote
  #6  
Old 12-12-2008, 09:14 AM
Mosh's Avatar
Mosh Mosh is offline
 
Join Date: Aug 2004
Location: Melbourne, Australia
Posts: 1,968
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, this is tested and working:

Like Lynne said - "You can just turn the option off in vboptions > forum home page > display logged in users (displayloggedin will equal 0)"

Then replace:
PHP Code:
// ### LOGGED IN USERS #################################################
$activeusers '';
if ((
$vbulletin->options['displayloggedin'] == OR $vbulletin->options['displayloggedin'] == OR ($vbulletin->options['displayloggedin'] > AND $vbulletin->userinfo['userid'])) AND !$show['search_engine'])

with:

PHP Code:
// ### LOGGED IN USERS #################################################
$activeusers '';
if ((
$vbulletin->options['displayloggedin'] == OR $vbulletin->options['displayloggedin'] == OR ($vbulletin->options['displayloggedin'] > AND $vbulletin->userinfo['userid']) OR is_member_of($vbulletin->userinfo,5,6,7)) AND !$show['search_engine'])

Reply With Quote
  #7  
Old 12-12-2008, 02:48 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mosh posted the correct code (I should have spelled it out, sorry). But, you need to make sure you also set that option to NO (which Mosh also restated in his post).
Reply With Quote
  #8  
Old 12-12-2008, 02:54 PM
Sharron Sharron is offline
 
Join Date: Oct 2007
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It worked beautifully thank you I can't have been getting it in the right place but once I copied the code as Mosh typed it it worked.

Thank you for your help both of you.
Reply With Quote
Reply

Thread Tools
Display Modes

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:06 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.07328 seconds
  • Memory Usage 2,246KB
  • Queries Executed 11 (?)
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_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_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