PDA

View Full Version : Count users on a certain page


SH0CK
11-23-2014, 08:36 PM
I'm trying to figure out how I could use Vbulletin to report to me how many users are on a particular page, then turn this into a variable that I can plug into the template for navigation?

We have a chat page, let's say it is chat.php, which shows up under "Who's online" as Unknown Location /forums/chat.php

Is there a way to use this information to get a count of users accessing the page and set it as a variable so we can display it elsewhere?

Thanks!

ozzy47
11-23-2014, 08:40 PM
Your best bet would be to ask in the modifications thread, like how they store the users in the chat mod, and if what you want to do is even possible.

SH0CK
11-24-2014, 12:21 PM
It is a flash IRC client running on the chat.php, so the only interaction it has with the board is that it's housed on a forum page and pulls the usernames when you first login to the client. I don't think it stores any info other than showing on the online page that someone is accessing that page.

I was just thinking there would have to be a way to set a number variable for how many user are accessing a particular thread or page at one time and being able to report it. Maybe a SQL query?

Admins, if this question needs to be in another area of this board, please move it for me. Thanks!

Dave
11-24-2014, 12:29 PM
The session table has a column called location, which you can use to count the number of users who are on that specific page.

SELECT COUNT(*) as users FROM session WHERE location = 'chat.php'

Might want to add a check on the last activity though.

kh99
11-24-2014, 12:31 PM
If the chat page shows up in "who's online", then you should be able to do a query to find out how many users are showing up as chatting (Edit: like Dave mentioned above). But that would only tell you how many people have looked at the chat page in the last 15 minutes (or whatever your session timeout is set to) and not necessarily how many users are active. The flash client probably knows how many users are active, but unless it has some kind of interface to share that info, then I'm not sure if there's any way to do what you want.

cellarius
11-24-2014, 12:32 PM
Well, AFAIK the last known location (as a path relative to forum root) for every active user session. You could just run a count across that table, filtering by location.

That's pretty rough, of course, but the only possibility I can think of. vB itself AFAIK does nothing else for its own active users in forums functionality.

--------------- Added 1416839589 at 1416839589 ---------------

Yeah, well, three answers, and I come in last *lol*. I blame my wife asking me questions...

kh99
11-24-2014, 12:37 PM
Oh, and sorry, but I should have done this instead of answering:

SH0CK,

You are currently showing up as unlicensed.

To be able to download modifications and/or receive support here at vBulletin.org, we ask you to please click here (http://members.vbulletin.com/membersupport_priority.php) (vB-Germany users click here (http://members.vbulletin-germany.com/membersupport_priority.php)) and enter your email address. You will need to use your customer number and password (which will be in the email you got when you paid for your license) to access that page. Please note that your email is case sensitive.

To protect our customers privacy you will also need to Opt-In to license validation for all Support Sites. You must authorise vBulletin.org in order to validate your license status here. You can do this at the page linked above for your distributor. Make sure to set the permission to allow vBulletin.org to validate your status.

The update of your account can take up to one hour.

Thank you.

SH0CK
12-17-2014, 11:51 PM
Sorry it took so long to reply back. Had to get that pesky unlicensed thing to go away after updating my email addy here.

Thank you all for the point in the right direction. That SQL query is just the thing I was looking for. Now to work on using that info. :)

Thanks!

ozzy47
12-17-2014, 11:53 PM
Well glad to see you sorted the unlicensed thing. :)