The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Counting users online
Hi all!
I already posted this request into the wrong section, and a Mod suggested me to post here, so sorry for double post. I'm searching an easy way to count (every n minutes) users online (both members and guests), display the value and write the value to a db table. I need this for statistics, monitoring and optimization purposes. Unfortunately, I'm not a php programmer... Any ideas? Thank you |
#2
|
|||
|
|||
Here's something simple that might do it:
1) Put this in a file named something like usercount.php (or whatever you want) and put it in includes/cron. PHP Code:
3) Add a scheduled task using ./includes/cron/usercount.php as the file name. My guess is that it won't make any sense to run the task at a shorter interval than your session timeout is set to. A couple other things - scheduled tasks don't run if no one visits your board, so during times of no users (if you have any) you won't have counts. Also, if your board is very busy I think there's a chance that the task will occasionally run twice. But since the records have a timestamp, you should be able to deal with either of those things when analyzing your data. I tested this a little, but not that much so you'll probably want to test it some before counting on it to work right. |
#3
|
|||
|
|||
Hello kh99
thank you very much for your help! Unfortunately, the script not worked for me. The table remains empty... Furthermore... is there a way to have the three valued visualized on the screen? Or maybe this impact on the cron? Thank you --------------- Added [DATE]1289032837[/DATE] at [TIME]1289032837[/TIME] --------------- Additional info: the script exit here: Code:
if (!is_object($vbulletin->db)) { echo "Exit"; exit; } |
#4
|
|||
|
|||
Quote:
PHP Code:
Next you need to create a plugin using hook location init_start with this code: PHP Code:
Then in a template where you want to display it add something like: PHP Code:
Quote:
Or maybe someone else has an idea? ETA: I could make it all a product and post an xml file to import if you'd like. |
#5
|
||||
|
||||
You need to run that script as a cron job/scheduled task, not as a standalone file.
|
#6
|
|||
|
|||
Quote:
I'm very sorry for my inexperience. It is possible to turn it as a standalone php script? Thank you. |
#7
|
|||
|
|||
I suppose there's some way to make it a stand-alone script and use an actual cron job. But it's easy to create a scheduled task. In the admin control panel, under "Scheduled Tasks" click on "Add New Scheduled Task" and fill in the fields. There's help available for each field by clicking on the ? icons on the right, but most of the text ones don't really matter, you just have to make something up. If you need more help you could go to the vbulletin manual and read about it.
To make it run periodically, select the times of the hour you want it to run from the drop-down menus next to "Minutes". For instance if you want it to run every 15 minutes you might choose 15, 30, 45, and 00. Leave all the other time fields as '*' or '-'. When you get to the 'Filename' field, enter the name of the file (you just have to fill in 'usercount' before the .php). Save it and that's it. You can wait for it to run or you can go to "Scheduled Task Manager" and press the "Run Now" button next to that task to force it to run whenever you want. |
#8
|
|||
|
|||
[deleted this, see below instead]
|
#9
|
||||
|
||||
What you forgot to say is you still need that file and it should be uploaded to the /includes/cron directory (just in case he thinks all he needs is the product file).
|
#10
|
|||
|
|||
Yes, I see now that what he is probably looking for is a complete mod he can simply install and have it all working. I'm afraid even if this works it won't have all the needed features.
So, if anyone else wants to take that on please do. vbdarwin, if you want to start another thread and maybe refine your request I'll let someone else answer that one. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|