function advanced_forum_statistics_online_users in Advanced Forum 5
Same name and namespace in other branches
- 6.2 advanced_forum.module \advanced_forum_statistics_online_users()
- 6 advanced_forum.module \advanced_forum_statistics_online_users()
- 7.2 advanced_forum.module \advanced_forum_statistics_online_users()
Return an array of online usernames, linked to their profiles.
1 call to advanced_forum_statistics_online_users()
- advanced_forum_preprocess_advf_forum_statistics in ./
advanced_forum.module - Preprocesses template variables for the forum statistics template.
File
- ./
advanced_forum.module, line 1645 - Enables the look and feel of other popular forum software.
Code
function advanced_forum_statistics_online_users() {
$list = array();
$interval = time() - variable_get('user_block_seconds_online', 900);
$sql = 'SELECT DISTINCT u.uid, u.name, MAX(s.timestamp) as maxtime
FROM {users} u
INNER JOIN {sessions} s ON u.uid = s.uid
WHERE s.timestamp >= %d AND s.uid > 0
GROUP BY u.uid, u.name
ORDER BY maxtime DESC';
$authenticated_users = db_query($sql, $interval);
while ($account = db_fetch_object($authenticated_users)) {
$list[] = theme('username', $account);
}
return $list;
}