• Welcome to Simple Machines Community Forum. Please login or sign up.

ssi_logOnline Output Modification

Started by MobileCS, December 11, 2016, 01:21:48 AM

Previous topic - Next topic

MobileCS

I'm modifying the output of ssi_logOnline function. However when doing so, it no longer "logs the user's online presence".

$online_users = ssi_logOnline('array');
$forum_guests = $online_users['guests'];
$forum_users = $online_users['num_users'];
foreach ($online_users['users'] as $user)
{
$forum_username = $user['username'];
$username_link = $user ['href'];
$forum_username_list .= "<a href=\"$username_link\">$forum_username</a>, ";
}
$forum_username_list = rtrim($forum_username_list, ", ");

echo "<p class=\"center\">$forum_guests Guests, $forum_users Users";
echo "<br />$forum_username_list</p>";


When refreshing the webpage, my username no longer moves to the front the of username list + I'll be dropped off the list after 15 minutes unless I visit the forum.

Is this the intended behavior? What can I do to fix this?

Kindred

I am not sure about the front of the user list, but dropped after 15 mins... yes. That is correct and expected behavior
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MobileCS

Ok, what exactly is the difference between ssi_whosOnline and ssi_logOnline then?

The wiki shows that ssi_logOnline is "exactly like ssi_whosOnline but it also logs the user's online presence". However, it's not doing that for me.

Unless I am misunderstanding what "logs the user's online presence" means?


Kindred

it logs the user's presence... but unless the user continues to get logged, the 15 minute timeout for online listing starts counting the moment that the log is inititated
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MobileCS

What I am seeing is that if I use :

<?php ssi_logOnline(); ?>

Everything works fine, and if I navigate to any page (outside the forum) on my website, my name in the user list gets bumped to the front of the row and it "logs my online presence".

However, when I use :

$online_users = ssi_logOnline('array');

and modify the results myself, this no longer happens - my name no longer bumps to the front of the list. Navigating my website does not "log my online presence".

Kindred

right.... because when you read the output to an array, YOU have to do all of the work for display and db/server sync....  and you'r not doing that second bit.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MobileCS

Yes, but is there a way for me to "enable" the second bit? (log online presence)

Kindred

Look at how the function does it in ssi if you don't read it out as an array
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: