By NeoID on
I'm using the following code to display if a user is logged in or not, however, anyone who could explain me how to make it more "sesitive"?
The code below works, but it takes way to long time before a user is displayed as offline... What does '60' and '30' mean?
<?php if (round((time()-$profileuser->access)/60) < 30) {
print "<div id=\"user_online\"></div>";
} else {
print "<div id=\"user_offline\"></div>";
}
?>Thanks
Comments
just guessing
I'm just guessing here but I'm assuming that the 60 is used to convert the time in to minutes (e.g. 600 seconds divided by 60 = 10 minutes) and so the the "< 30" is a conditional statement asking if the time the user has been offline is less than 30 minutes, if so print they are online if it's greater than 30 print they are offline.
So to be more sensitive just decrease the 30 to a number more suitable for you
Nifty, yet this didn't show
Nifty, yet this didn't show anything in my demo. I imagine the profileuser/account needs loaded?
Regards,
Czar
The snippet is from a file
The snippet is from a file called node-uprofile.tpl.php, you can download the file here, maybe it's helpfull...
http://dev.shellmultimedia.com/node/55
Anyway, thanks it's working perfectly now ;)