vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Who's Online / Total Users (https://vborg.vbsupport.ru/showthread.php?t=166654)

Hex_legend 01-01-2008 08:03 PM

Who's Online / Total Users
 
What code do I put to show Number Of Users Online / Total Users somewhere else?

Just below my Navbar, I have a code that says:

We have X users online, of a total X.


I need to find the code to replace the X



====== Since this post, I have... ========

Found a hack that runs the queries in the header, but phpinclude_start template does not exist in 3.7.

Where else can I add:

Code:

if (strpos($_SERVER['PHP_SELF'], 'index.php') == false) {
$datecut = TIMENOW - $vboptions['cookietimeout'];
$headerguests=$DB_site->query_first("SELECT COUNT(*) AS count FROM session WHERE userid=0 AND lastactivity>$datecut");
$headerusers=$DB_site->query_first("SELECT COUNT(DISTINCT(userid)) AS count FROM session WHERE session.userid>0 AND session.lastactivity>$datecut");
$headerguests=$headerguests[count];
$headerusers=$headerusers[count];
$totalonline=$headerguests+$headerusers;
}


MrPHD 01-01-2008 08:50 PM

Quote:

Originally Posted by Hex_legend (Post 1413363)
What code do I put to show Number Of Users Online / Total Users somewhere else?

Just below my Navbar, I have a code that says:

We have X users online, of a total X.


I need to find the code to replace the X



====== Since this post, I have... ========

Found a hack that runs the queries in the header, but phpinclude_start template does not exist in 3.7.

Where else can I add:

Code:

if (strpos($_SERVER['PHP_SELF'], 'index.php') == false) {
$datecut = TIMENOW - $vboptions['cookietimeout'];
$headerguests=$DB_site->query_first("SELECT COUNT(*) AS count FROM session WHERE userid=0 AND lastactivity>$datecut");
$headerusers=$DB_site->query_first("SELECT COUNT(DISTINCT(userid)) AS count FROM session WHERE session.userid>0 AND session.lastactivity>$datecut");
$headerguests=$headerguests[count];
$headerusers=$headerusers[count];
$totalonline=$headerguests+$headerusers;
}


Go to you Plugin Manager and add plugin on parse_template is the same like phpinclude_template only existe on 3.5.0 versions.

Hex_legend 01-01-2008 08:55 PM

I can't seem to find Parse_Template either :S

I am using vbulletin 3.7

MrPHD 01-01-2008 09:03 PM

Quote:

Originally Posted by Hex_legend (Post 1413395)
I can't seem to find Parse_Template either :S

I am using vbulletin 3.7


- Create New Plugin:

Now create a new plugin for the parse_templates hook location:

Admin CP -> Plugins & Products -> Add New Plugin

- Next:

hook = parse_templates
title = whatever
execution order = whatever
php code = the code that used to go in the phpinclude template.

Hex_legend 01-01-2008 09:09 PM

Thanks.

I have added all that into a plugin.

I put $totalonline into the header but still nothing shows :|

What's happening?

MrPHD 01-01-2008 09:21 PM

Quote:

Originally Posted by Hex_legend (Post 1413401)
Thanks.

I have added all that into a plugin.

I put $totalonline into the header but still nothing shows :|

What's happening?

I?m gona try on my test forum, take a minute.

Hex_legend 01-01-2008 09:24 PM

1 Attachment(s)
Here are the install instructions then, has extra info to complete:

*WARNING*

Do not create a plugin with the data as it causes MySql errors

MrPHD 01-01-2008 09:41 PM

1 Attachment(s)
Something like this?

Hex_legend 01-01-2008 09:43 PM

That's exactly what I want.

How exactly did you do it?

I added you on msn, could you have a look for me?


All times are GMT. The time now is 12:02 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.01035 seconds
  • Memory Usage 1,732KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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