Allow for hidden users

RAFA3L - July 9, 2009 - 17:24
Project:Advanced Forum
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

Hello,

I'm trying to hide the user admin (uid 1) in the stats and I found this in advanced_forum.module

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;
}

I change this line:

WHERE s.timestamp >= %d AND s.uid > 0

to

WHERE s.timestamp >= %d AND s.uid > 1

Is not hard to do, but is the only way? would be useful a GUI to hide users and roles.

#1

Michelle - July 9, 2009 - 17:51
Title:Hide user admin (uid 1) in stats» Allow for hidden users
Version:6.x-1.1» 6.x-2.x-dev
Status:active» postponed

I'm not going to make a setting just for that. At some point, if no one writes it first, I plan to make a seperate module for users to mark themselves hidden / invisible. At that point, AF as well as APK will hook into that.

If you want to do it without hacking the module, you could add a preprocess that sets that variable differently. That would mean both queries are running but it's a small query and shouldn't hurt performance any.

Michelle

#2

RAFA3L - July 14, 2009 - 00:03

Thanks! but I prefer don't add more queries

 
 

Drupal is a registered trademark of Dries Buytaert.