View Full Version : Total Number of Users Online Now on Every Page
Erwin
01-04-2004, 10:00 PM
Again, all credit goes to Chen for the original hack.
I've merely modified it, so that two extra queries are saved on forumhome - there's no point running the queries again since index.php has already calculated it.
This hack modifies 1 php file and 2 templates. It's easy.
Using my method, you save yourself 2 queries on forumhome. We use this at vB.org too. ;)
Instructions in the HTML file zipped below.
Koutaru
01-05-2004, 09:41 AM
Am I fast or what? Anyway.. I'm installing this one too since I installed it for vb2. If needed, I might just use users online to save myself a query.
You can also use $headerusers and $headerguests in the templates as well correct?
As in there are $headerusers users and $headerguests guests online.
FleaBag
01-05-2004, 07:34 PM
Nice work Erwin, I used the original until recently. When I eventually move over I shall definitely install this.
Nice!! I'll definetily use this!
/me clicks Install
MGM out
Destee
01-06-2004, 06:13 AM
Thank You Erwin For Sharing !!! It's Installed.
Destee
Boofo
01-10-2004, 05:00 AM
Erwin, does this handle private and password protected forums, too? I have an area on my site that is password protected as well as private and if you are in there, it only shows I user online no matter how many there are online. Any way to fix that?
Erwin
01-10-2004, 06:05 AM
Erwin, does this handle private and password protected forums, too? I have an area on my site that is password protected as well as private and if you are in there, it only shows I user online no matter how many there are online. Any way to fix that?
Weird, because my password-protected/ private forums show the numbers correctly. Is this a problem with anyone else?
neocorteqz
01-10-2004, 06:36 AM
Weird, because my password-protected/ private forums show the numbers correctly. Is this a problem with anyone else?
Lemme install and test it.
neocorteqz
01-10-2004, 06:57 AM
So far so good.
Boofo
01-12-2004, 09:45 PM
I found the problem. I had put the code in the navbar instead of the header. Apparently although the navbar shows up on every page, something messes it up when you go into any threads.
Boofo
01-22-2004, 04:02 AM
When I add the fetch template header in the index.php, it makes the top line for the bbinactive to not show up on forumhome. It will show up on other pages, just not forumhome. If I take that out of the index.php, then it shows up again. Any way to fix that?
Mr. Brian
01-28-2004, 08:54 PM
That's weird!
When ever I'm trying to add this on my top of my "phpinclude_start" template, I get a database error.
Add this on top of my phpinclude_start temp
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;
}
I get this
Database error in vBulletin 3.0.0 Gamma:
Invalid SQL: SELECT COUNT(*) AS count FROM session WHERE userid=0 AND lastactivity>1075329292
mysql error: Table 'soccerwi_soccerforum.session' doesn't exist
mysql error number: 1146
Date: Wednesday 28th of January 2004 03:49:53 PM
Script: http://www.what ever link I click other then my index page?
Referer: http://www.my forum/index.php?
Username: Me
IP Address: xx.xx.xxx
Did I miss out any thing?
Many thanks in advance..
LordJMann
02-09-2004, 12:14 AM
That's weird!
When ever I'm trying to add this on my top of my "phpinclude_start" template, I get a database error.
Add this on top of my phpinclude_start temp
I get this
Did I miss out any thing?
Many thanks in advance..
Do you have a table prefix you are using?
Boofo
02-13-2004, 06:37 AM
When I add the fetch template header in the index.php, it makes the top line for the bbinactive to not show up on forumhome. It will show up on other pages, just not forumhome. If I take that out of the index.php, then it shows up again. Any way to fix that?
Did anyone ever find a fix for this?
Mr. Brian
03-12-2004, 09:02 PM
Do you have a table prefix you are using?
Yes. No doubt!
BTW, I noticed whenever I'm trying to check/repair my db, I got this line:-
[code]soccerwi_soccerforum.soccerwi_soccerforumsession
error : The handler for the table doesn't support check[/b]
Any ideal why I got this?
thanks
brandy
03-21-2004, 01:29 PM
Hi, I installed this hack (really cool btw) but the home page displays funny, although all the other pages display fine. Can you tell me what I did wrong? You can see the home page at http://doggiedoor.com/forums/index.php?
Thanks,
Brandy :classic:
Tim Wheatley
03-28-2004, 10:17 AM
3.0 Gold here, I get a blank page on index.php and forum.php (which I use as my main page) with this installed.
Boofo
03-28-2004, 10:40 AM
Tim, have you noticed that the board closed line doesn't show at the top of the forumhome when the baord is closed? It shows at the bottom but not at the top for me. Have you run into anything like this?
Tim Wheatley
03-28-2004, 04:29 PM
I've uninstalled this now... Sorry. :)
For me I've always had it top and bottom.
Boofo
03-28-2004, 04:34 PM
Where did you have the code in the index.php? Maybe that's where I messed up.
brandy
03-28-2004, 08:47 PM
My problem was fixed. I had my own variable named "$header" and this hack uses that variable name. I needed to change my variable to a different name.
Now it works, thanks!
Brandy
Tim Wheatley
03-29-2004, 04:19 PM
As far as I'm aware I had it where the instructions stated... If I remember rightly above the call of the navbar template.
I did also put it in the php include template (at the top) with my existing code below it, my existing code in that template is:
// Example of how to include a seperate file:
// ob_start();
// require("yourheader.html");
// $header = ob_get_contents();
// ob_end_clean();
ob_start();
include("/data/docs/racesimcentral.com/docs/forum/banner.php");
$rsc_bannrz = ob_get_contents();
ob_end_clean();
ob_start();
include("/data/docs/racesimcentral.com/docs/forum/logos.php");
$rsc_logoz = ob_get_contents();
ob_end_clean();
Tim Wheatley
03-29-2004, 05:16 PM
Got it! There is a line break in the code to be inserted due to your html file, I do run 1280.1024 but still missed it. ;)
sabret00the
04-03-2004, 01:21 PM
installed without a hitch :D
calvinnguyen
04-05-2004, 12:56 AM
I found out at your hack have error for this one:
'forumhome_subforumseparator_post'
);
Replace with:
'forumhome_subforumseparator_post',
'header'
);
The correct one should be this:
'forumhome_subforumseparator_post',
'header',
);
ChrisLM2001
09-29-2004, 04:45 AM
Have a question: In #3 of the instructions it says to edit the header. Do you copy the header_include code and insert in there (and where)?
Thanks!
Chris
enginethatcan't
10-08-2004, 06:02 PM
The number isn't showing up, why?
enginethatcan't
10-08-2004, 06:04 PM
Nevermind -- forgot to upload the index.php file lol
ChrisLM2001
12-01-2004, 02:06 AM
Yes. No doubt!
BTW, I noticed whenever I'm trying to check/repair my db, I got this line:-
[code]soccerwi_soccerforum.soccerwi_soccerforumsession
error : The handler for the table doesn't support check[/b]
Any ideal why I got this?
thanksIf you're using a prefix, this the header template code to use (vB 3.0.3).....
if (strpos($_SERVER['PHP_SELF'], 'index.php') == false) {
$datecut = TIMENOW - $vboptions['cookietimeout'];
$headerguests=$DB_site->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "session WHERE " . TABLE_PREFIX . "session.userid=0 AND " . TABLE_PREFIX . "session.lastactivity>$datecut");
$headerusers=$DB_site->query_first("SELECT COUNT(DISTINCT(userid)) AS count FROM " . TABLE_PREFIX . "session WHERE " . TABLE_PREFIX . "session.userid>0 AND " . TABLE_PREFIX . "session.lastactivity>$datecut");
$headerguests=$headerguests[count];
$headerusers=$headerusers[count];
$totalonline=$headerguests+$headerusers;
}
Chris
yinyang
01-06-2005, 01:10 AM
first off, this hack rocks. it's perfectly elegant.
i've updated to 3.04 and it works fine. it also works on my vba cmps pages, but i think that may have to do with some of the other modules on it.
however, i just uploaded the vba links directory hack. the links.php or main page resides in a subforum called links. for the life of me, i cannot get the number of online users to show up on the links.php page.
help!! this makes my forum look totally non-uniform. i've already had to input $vboptions[bburl] (or something like that in front of every link because of the subforum issue.
is there anything that can be done to make this hack work on subforum pages as well?
-yinyang
clangrounds.com
02-02-2005, 06:21 AM
Worked like a charm, thanks! :)
trulylowcarb
02-03-2005, 04:38 PM
Very easily added to VB3.06 running on CMPS1.01 and working fine - thank you!
trulylowcarb
02-03-2005, 04:43 PM
Meant to ask if there is an easy way to add a line so it will show the sigma chat online users as well? Obviously, I have hacked that in to Who's Online already, but I am having trouble adding it to the CMPS index - this would solve that problem for me.)
Thanks in advance if someone can lend a hand here.
agiacosa
01-23-2006, 09:53 PM
Any port of this hack?
hbalagh1
02-24-2006, 04:57 AM
anyone know of this mod being ported to 3.5
hbalagh1
03-02-2006, 01:22 AM
anyone?
I'm interested in this hack... I think it should be pretty easy to import to 3.5....
can a nice coder please help?
nando99
11-12-2008, 12:40 AM
I'm actually looking for something like this for 3.7.... great idea....
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.