Firefox PHP

online/offline user icon

Posted by pokafacecity 
online/offline user icon
September 21, 2007 06:09PM
i would like to show an online/ offline icon next to username in my phorum.i already have the online module which shows a list of online users. i want to display an icon when a user is online and offline next to his/her username.

any help or suggestions.

ive seen alot of other forums with this same feature.
Re: online/offline user icon
September 21, 2007 10:34PM
ok i got it to show online but it doesnt show offline properly. i added the code below to my profile.php at the very bottom. any suggestions.






<?php
print " Status";
$time_period = phorum_user_get('user_block_seconds_online', 2700);
$user = phorum_user_get($profile_id); // get the current userid that is being viewed.
$users = phorum_db_user_check_field("date_last_active", time() - ($PHORUM["idle_time"] * 1), ">=", true);

if (!$output) {
echo "<FONT COLOR=#DD0000><B>ONLINE</B></FONT>";
} else {
echo "<FONT COLOR=#00DD00><B>OFFLINE</B></FONT>";
}
@fclose($output);
?>



Edited 1 time(s). Last edit at 09/21/2007 10:36PM by pokafacecity.
Re: online/offline user icon
September 22, 2007 06:19AM
I have no idea what this line is supposed to do. The var is not used in the rest of the code and this is not the way in which phorum_user_get() is supposed to be called.
$time_period = phorum_user_get('user_block_seconds_online', 2700);

The $user variable from this line is not used in the piece of code.
$user = phorum_user_get($profile_id); // get the current userid that is being viewed.

This looks useful for retrieving all on line users:
$users = phorum_db_user_check_field("date_last_active", time() - ($PHORUM["idle_time"] * 1), ">=", true);

What is $output? It is not defined in any part of the code block?? It would have to evaluate as a true value when the user is off line.
if (!$output) {

This implies that the above $output variable is a file handle that was opened using fopen(). I really cannot see what this is used for, but it sounds like a file that was opened for writing based on its filename.
@fclose($output);

In total... I do not follow the logic of this code block at all. Is this only a small part of the code? Please provide more context. If this is the whole code block, then I can see why you would only see ONLINE for users, since $output is empty, which will make (!$output) true.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 09/22/2007 06:21AM by mmakaay.
Re: online/offline user icon
September 22, 2007 02:04PM
You are right. non of the above code checks to see if the user is loged in to show online/offline correctly. i put some codes together trying to just show online/offline correctly. this should be an easy thing for phorum, but i just dont no how to do it.

ive spent like a week and alot of lost sleep trying to accomplish this.

i would appreciate it if you help me put this together Maurice. ive read almost this entire site and the web no luck.
Sorry, only registered users may post in this forum.

Click here to login