PDA

View Full Version : Statistics Modifications - Display Online Users Count Everywhere (vB 4)


NeutralizeR
03-28-2010, 10:00 PM
Description: This mod will add online users count info to any vBulletin page.

Example:
23 Users Online (6 members and 17 guests)Two small queries are executed, same with the Admin CP online users stat.

Details: You don't have to enable "Display Logged in Users?" options (forumhome,showthread,forumdisplay) which requires serious resources to run this mod. I haven't noticed any performance problems with more than 10k online users.

Screenshots:
https://vborg.vbsupport.ru/

http://img149.imageshack.us/img149/4370/snap2l.png
Installation:
1-) Import product-msx_online_count_vb3.xml
2-) Edit navbar template (or *any template you prefer) and add:
<!-- Display Online Users Count -->
<b>{vb:raw msxtotal}</b> users online ({vb:rawphrase x_members_and_y_guests, {vb:raw msxmembers}, {vb:raw msxguests}})
<!-- / Display Online Users Count -->*If you want to add the HTML code to a different template than navbar template:
Edit Get Online Users Count plugin and change 'navbar' with the template name.

vBulletin 3.8.x version is here: https://vborg.vbsupport.ru/showthread.php?t=239361

Kolbi
03-29-2010, 05:59 PM
I guess this could be very useful in some cases :)

NeutralizeR
03-29-2010, 06:04 PM
I guess this could be very useful in some cases :)
Yes, it was really annoying to manually disable forumhome,showthread,forumdisplay online users stats each time at the peak times for me :)

ericgtr
03-29-2010, 08:21 PM
Neat mod, I can't get it to work in the header after changing navbar to header in the plugin and putting the code in the header though. Works fine in the navbar but I would prefer to have it in the header.

NeutralizeR
03-29-2010, 08:38 PM
Neat mod, I can't get it to work in the header after changing navbar to header in the plugin and putting the code in the header though. Works fine in the navbar but I would prefer to have it in the header.
vB_Template::preRegister('header',array('msxtotal' => $msxtotal, 'msxmembers' => $msxmembers, 'msxguests' => $msxguests));

I don't have vB4 installed, but i've just tested on my friends site and the code above is working.

ericgtr
03-29-2010, 08:53 PM
vB_Template::preRegister('header',array('msxtotal' => $msxtotal, 'msxmembers' => $msxmembers, 'msxguests' => $msxguests));

I don't have vB4 installed, but i've just tested on my friends site and the code above is working.
That's what I have too but it won't work in the header. I have a feeling the hook location needs to be changed for the header, just not sure which one.

NeutralizeR
03-29-2010, 09:16 PM
Weird. The site i tested is using vb 4.0.2 PL4 with vBSEO and no other mods installed. Any caching system etc enabled? Sorry for not being able to suggest solutions as i don't have vb4 :( How you tried any other templates?

Maybe another user installs this mod and tells us if it works for him in the header...

ericgtr
03-29-2010, 09:46 PM
Weird. The site i tested is using vb 4.0.2 PL4 with vBSEO and no other mods installed. Any caching system etc enabled? Sorry for not being able to suggest solutions as i don't have vb4 :( How you tried any other templates?

Maybe another user installs this mod and tells us if it works for him in the header...
That's cool, I did try it in the navbar and can confirm it works fine there. :)

NeutralizeR
03-29-2010, 09:47 PM
One last try... Add this code to the header template just before the last </div> to test...

<!-- Display Online Users Count -->
<b>{vb:var msxtotal}</b> users online ({vb:rawphrase x_members_and_y_guests, {vb:var msxmembers}, {vb:var msxguests}})
<!-- / Display Online Users Count -->

ericgtr
03-29-2010, 09:54 PM
One last try... Add this code to the header template just before the last </div> to test...

<!-- Display Online Users Count -->
<b>{vb:var msxtotal}</b> users online ({vb:rawphrase x_members_and_y_guests, {vb:var msxmembers}, {vb:var msxguests}})
<!-- / Display Online Users Count -->
Still no luck.

Alecsmith
03-30-2010, 09:15 AM
any demo or screenshot?

RoAjayson
03-30-2010, 10:01 AM
Any idea on how to get this working with vbadvanced as well?

Edit: figured it out, just added on
vB_Template::preRegister('adv_portal',array('msxto tal' => $msxtotal, 'msxmembers' => $msxmembers, 'msxguests' => $msxguests));

NeutralizeR
03-30-2010, 11:47 AM
For vBadvanced (vBulletin 3):

Open Portal Output Global Variables and add the lines below to the list:
msxtotal
msxmembers
msxguests

NeutralizeR
03-30-2010, 12:18 PM
any demo or screenshot?
Added.

AzzidReign
04-01-2010, 12:37 AM
Thank you!

Prorockz
04-02-2010, 10:42 AM
wanna use like this how and where i add code for it .

http://img6.imageshack.us/img6/2918/snap1sw.png

valendono
04-02-2010, 11:26 AM
still no luck for me too, its doesn't show anything just " Users online ( members and guests) " and it plus 2 more mysql queries

NeutralizeR
04-02-2010, 01:40 PM
still no luck for me too, its doesn't show anything just " Users online ( members and guests) " and it plus 2 more mysql queries

@Prorockz

It's custom design in the navbar template.

@valendono

Have you done the installation step two? It should work at navbar. I'm gonna install a local version of vb4 and test it in the header.

NeutralizeR
04-02-2010, 03:07 PM
Fresh vBulletin 4 installation.

I edited the plugin code (changed navbar to header) and the header template (added the HTML) and it simply worked. Check the screenshots.

imported_soft
09-10-2010, 02:58 AM
what is the possibility to add forum thread and post to it?

Sean James
09-21-2010, 05:03 PM
A version with threads and posts would be great.

Tamara-Jasmin
04-09-2011, 05:57 PM
Also ich bastel jetzt schon mehrere Tage an dem Teil und bekomme es NICHT nach ganz oben geschoben. Vielleicht hat ja einer eine Info für mich wie das geht.
Ausserdem bekomme ich auf der Startseite NIE die Useranzahl angezeigt und manchmal auch falsche Werte (so werde ich z.B. manchmal gar nicht angezeigt).
Irgendwie ist das Teil nicht wirklich ausgereift - die Idee finde ich aber schon mal gut.

Liebe Grüsse:
Tammy

Ps. Hoffe hier können auch einige Deutsch lesen - Englisch kann ich nämlich kein Wort. Also Sorry.

Attila85
10-19-2011, 06:23 PM
I did all the modification needed, and I changed the Hook to be global_start since I put it in the header, but It does not get the counters. You can see an example on www.thesims3.it on the top header.
Any idea?

Attila85
10-20-2011, 03:03 PM
Yes I did but still no results.
Here is the code I added in the header template:

<!-- Display Online Users Count -->
<b>{vb:raw msxtotal}</b> utenti online ({vb:rawphrase x_members_and_y_guests, {vb:raw msxmembers}, {vb:raw msxguests}})
<!-- / Display Online Users Count -->

Here the code of the plugin:

// get online users
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
$guestsarry = $db->query_first("SELECT COUNT(host) AS sessions FROM " . TABLE_PREFIX . "session WHERE userid = 0 AND lastactivity > $datecut");
$membersarry = $db->query_read("SELECT DISTINCT userid FROM " . TABLE_PREFIX . "session WHERE userid <> 0 AND lastactivity > $datecut");
$msxguests = intval($guestsarry['sessions']);
$msxmembers = intval($db->num_rows($membersarry));
$msxtotal = $msxmembers + $msxguests;
vB_Template::preRegister('header',array('msxtotal' => $msxtotal, 'msxmembers' => $msxmembers, 'msxguests' => $msxguests));
// get online users

Position: Global_start
Execution order: 5
Plugin is active.

But still no results, as you can see... any hint?

Attila85
10-20-2011, 03:06 PM
Well.. it seems working now... but I did not edit anything... wtf? :P

kh99
10-20-2011, 03:09 PM
Great. :) That happens to me sometimes - either I was looking at the wrong style, or I forgot to enable the plugin, or something.

Attila85
10-22-2011, 01:15 PM
I donnow why now it works everywhere but in the home page (Http://www.thesims3.it) .. any idea?

Attila85
11-13-2011, 01:45 PM
Up, anybody has an idea? It's so strange that it works everywhere but the home...

Brandon Sheley
11-13-2011, 02:32 PM
nice mod, I'd add this to my forum if I was running vb right now
I'll keep it in mind for clients :)

Thanks for sharing!

Seba123
11-17-2011, 08:13 PM
Two queries, bad.

AndrewSimm
01-25-2013, 12:13 AM
What does each of those queries do? I want to show just the total number of users and nothing else. Also how can I make it work on the CMS?

rodriiverduguez
09-16-2018, 03:07 AM
edit the plugin part of "PreRegister ('navbar', array ..." by "PreRegister ('header', array ..." and it is showing in Header or wherever you want.

run 4.2.5

Google Translate