Code: Select all
<!-- IF S_ONLINE -->Online!<!-- ELSE -->Offline<!-- ENDIF -->
Code: Select all
<!-- IF memberrow.S_ONLINE -->Online!<!-- ELSE -->Offline<!-- ENDIF -->
Code: Select all
if ($config['load_onlinetrack'])
{
$update_time = $config['load_online_time'] * 60;
$online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
}
else
{
$online = false;
}
Code: Select all
if ($config['load_onlinetrack'])
{
$update_time = $config['load_online_time'] * 60;
$online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $data['user_allow_viewonline'] || $auth->acl_get('u_viewonline'))) ? true : false;
}
else
{
$online = false;
}
In memberlist_view.html online/offline status is getting displayed for all users by default.vortexhlp wrote:Oh i see, the friend system isn't completed I think? Hmm... Then how would I go about adding online/offline statuses for friends in memberlist_view.html?
Code: Select all
// Get user...
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");
$result = $db->sql_query($sql);
$member = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Code: Select all
// Get user...
$sql = 'SELECT u.*, z.friend, z.foe
FROM ' . USERS_TABLE . ' u LEFT JOIN ' . ZEBRA_TABLE . ' z
ON z.user_id = u.user_id AND z.zebra_id = ' . $user->data['user_id'] . '
WHERE ' . (($username) ? "u.username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "u.user_id = $user_id");
$result = $db->sql_query($sql);
$member = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Code: Select all
// Dump it out to the template
return array(
Code: Select all
'S_FRIEND' => ($data['friend']) ? true : false,
'S_FOE' => ($data['foe']) ? true : false,
Code: Select all
<!-- IF S_ONLINE -->
Code: Select all
<!-- IF S_ONLINE and S_FRIEND -->
Code: Select all
function is_user_online($user_id)
{
global $db, $config, $auth;
if($config['load_onlinetrack'])
{
$sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline
FROM ' . SESSIONS_TABLE . '
WHERE session_user_id = '.$db->sql_escape($user_id);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($sql);
$session_time = (isset($row['session_time'])) ? $row['session_time'] : 0;
$session_viewonline = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0;
$allow_viewonline = ($session_viewonline || $auth->acl_get('u_viewonline')) ? true : false;
$update_time = $config['load_online_time'] * 60;
$online = ((time() - $update_time < $session_time) && ($allow_viewonline)) ? true : false;
return $online;
}
return false;
}