I had seen an Online/Offline indicator next to users posts on some older boards..so I tried to implement it myself using memberlist code that basically does the same thing (since you can setup your memberlist to include an 'Online' column)...
In public_memberlist.pl there is a
foreach (@ML_online_array) {
($ML_online_time, $ML_online_user, $ML_online_number, $ML_online_ip, $ML_online
_location) = split(/|^|/, $_); chomp($ML_online_location);
if ($ML_usernum eq $ML_online_number) {
print qq~
 | ~;
$ML_online_found++;
}
}
if (!$ML_online_found) {
print qq~
| ~;
}
That is the code used to either display the Online .GIF or leave the 'Online' column blank; depending on their current status.
So I tried to copy that code over to my public_topic_page.pl and replace the print qq~... lines to $this_online = qq(... then just toss $this_online wherever I wanted the indicator to show...and this actually works; kinda.
In many other hacks, you would just define something like
if ($whatever = 'yes') {
$this_blah = "Status: Online";
} else {
$this_blah = "Status: Offline";
}
But when I do this here (using the if statement I took from public_memberlist.pl)...it doesn't seem to actually get evaluated properly. If I have the 'else', it will make everyone show as offline and if I don't have the 'else', it will make everyone online.. . so I thought maybe it needed to be reset each time or something (I'm no programmer, BTW) and I could just setup the variable with value "" (blank) before it really gets defined, but apparently there's more than meets the eye.
I had been tinkering with the code a little while with no luck, so I thought I'd get some help in doing this. I hope I've explained myself properly; if not, inquire and I will carify.
Thanks
% SS %
[ 01-07-2002 01:48 AM: Message edited by: Soul Survivor ]