$query = "SELECT DISTINCT count(login_user_id) as count
FROM $track_online_table INNER JOIN $friend_user_table ON (friend_user_id = login_user_id)
WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."' AND user_id = '".api_get_user_id()."' ";
WHERE login_date >= '$current_date' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."' AND user_id = '".api_get_user_id()."' ";
} else {
// All users online
$query = "SELECT count(login_id) as count FROM ".$track_online_table ."
WHERE login_user_id <> 2 AND DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' ";
$query = "SELECT count(login_id) as count FROM $track_online_table
WHERE login_user_id <> 2 AND login_date >= '$current_date' ";
$query = "SELECT DISTINCT count(login_user_id) as count
FROM $track_online_table track
INNER JOIN $friend_user_table ON (friend_user_id = login_user_id)
WHERE track.access_url_id = $access_url_id AND DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."' ";
WHERE track.access_url_id = $access_url_id AND login_date >= '".$current_date."' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."' ";
} else {
// all users online
$query = "SELECT count(login_id) as count FROM $track_online_table track
WHERE login_user_id <> 2 AND track.access_url_id = $access_url_id AND DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' ";
$query = "SELECT count(login_id) as count FROM $track_online_table track
WHERE login_user_id <> 2 AND track.access_url_id = $access_url_id AND login_date >= '$current_date' ";
}
}
}
@ -317,14 +317,16 @@ function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit