PDA

View Full Version : Total Number of Users Online Now on Every Page


Erwin
05 Jan 2004, 11:37
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
05 Jan 2004, 11:41
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
05 Jan 2004, 21:34
Nice work Erwin, I used the original until recently. When I eventually move over I shall definitely install this.

MGM
06 Jan 2004, 02:21
Nice!! I'll definetily use this!

/me clicks Install

MGM out

Destee
06 Jan 2004, 08:13
Thank You Erwin For Sharing !!! It's Installed.

Destee

Boofo
10 Jan 2004, 07:00
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
10 Jan 2004, 08:05
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
10 Jan 2004, 08:36
Weird, because my password-protected/ private forums show the numbers correctly. Is this a problem with anyone else?
Lemme install and test it.

neocorteqz
10 Jan 2004, 08:57
So far so good.

Boofo
12 Jan 2004, 23:45
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
22 Jan 2004, 06:02
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
28 Jan 2004, 22:54
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
09 Feb 2004, 02:14
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
13 Feb 2004, 08:37
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
12 Mar 2004, 23:02
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
21 Mar 2004, 15:29
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
28 Mar 2004, 12:17
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
28 Mar 2004, 12:40
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
28 Mar 2004, 18:29
I've uninstalled this now... Sorry. :)

For me I've always had it top and bottom.

Boofo
28 Mar 2004, 18:34
Where did you have the code in the index.php? Maybe that's where I messed up.

brandy
28 Mar 2004, 22:47
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
29 Mar 2004, 18:19
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:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Tim Wheatley
29 Mar 2004, 19:16
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
03 Apr 2004, 15:21
installed without a hitch :D

calvinnguyen
05 Apr 2004, 02:56
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
29 Sep 2004, 06:45
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
08 Oct 2004, 20:02
The number isn't showing up, why?

enginethatcan't
08 Oct 2004, 20:04
Nevermind -- forgot to upload the index.php file lol

ChrisLM2001
01 Dec 2004, 04:06
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).....



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Chris

yinyang
06 Jan 2005, 03:10
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 Feb 2005, 08:21
Worked like a charm, thanks! :)

trulylowcarb
03 Feb 2005, 18:38
Very easily added to VB3.06 running on CMPS1.01 and working fine - thank you!

trulylowcarb
03 Feb 2005, 18:43
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
23 Jan 2006, 23:53
Any port of this hack?

hbalagh1
24 Feb 2006, 06:57
anyone know of this mod being ported to 3.5

hbalagh1
02 Mar 2006, 03:22
anyone?

Polo
30 Jun 2006, 23:27
I'm interested in this hack... I think it should be pretty easy to import to 3.5....

can a nice coder please help?

Polo
14 Jul 2006, 21:44
anybody?

nando99
12 Nov 2008, 02:40
I'm actually looking for something like this for 3.7.... great idea....