vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Users online for mods/admins only (https://vborg.vbsupport.ru/showthread.php?t=198646)

Sharron 12-11-2008 11:40 PM

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?

Lynne 12-12-2008 02:09 AM

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.

Sharron 12-12-2008 08:07 AM

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.

Mosh 12-12-2008 08:17 AM

Quote:

Originally Posted by Sharron (Post 1683706)
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))



Sharron 12-12-2008 08:38 AM

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.

Mosh 12-12-2008 09:14 AM

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'])



Lynne 12-12-2008 02:48 PM

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).

Sharron 12-12-2008 02:54 PM

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.


All times are GMT. The time now is 03:19 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.01189 seconds
  • Memory Usage 1,754KB
  • 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
  • (3)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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