You are here

function advanced_forum_statistics_online_users in Advanced Forum 6.2

Same name and namespace in other branches
  1. 5 advanced_forum.module \advanced_forum_statistics_online_users()
  2. 6 advanced_forum.module \advanced_forum_statistics_online_users()
  3. 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_advanced_forum_statistics in includes/theme.inc
Preprocesses template variables for the forum statistics template.

File

./advanced_forum.module, line 780
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;
}