PDA

View Full Version : adding users to my "currently active users" list


DionDev
10-08-2011, 05:10 AM
i just got back into vbulletin

now i am currently working on a mod

basically, i want this mod to select 50 random users from the DB, and add them to the "currently active users" list so that people visiting my forum see that its busy.

i wrote some code, but so far, its not populating the "currently active users" list on the homepage, but it is showing them in the online.php page.

heres my code:


mysql_query("insert into `session` (`sessionhash`, `userid`, `lastactivity`) values ('".md5(uniqid(microtime(), true))."', '$fuid', '".time()."')") or die(mysql_error());


$fuid comes from an array of 50 member userid's selected via a mysql query from the `user` table.

what am i missing?

kh99
10-08-2011, 12:46 PM
I can't see what's wrong. Maybe try temporarily editing forum.php like this:

if (fetch_online_status($loggedin) OR 1)
{
$numbervisible++;
$activeusers[] = $loggedin;
}


to see if the problem is with fetch_online_status() or before that.

DionDev
10-08-2011, 08:56 PM
it selects all results from the `session` table and ignores other filters that are done by the rest of the code.

and it worked PERFECTLY. thank you kh99!

kh99
10-08-2011, 10:03 PM
it selects all results from the `session` table and ignores other filters that are done by the rest of the code.

and it worked PERFECTLY. thank you kh99!


You're welcome - but it was only meant to be a test to see if something in fetch_online_status() was the problem. Looks like it is. Looking at that code, if lastvisit == lastactivity then it will return false, but if you're setting lastactivity in the session table then I don't know why it would be.