function user_is_queue_member($account) {
  global $user;
  /* 
   * if I omit the following check it creates
   * following error:
   * ==========================================================
   * warning: array_fill() [function.array-fill]: Number of elements must be positive in /data/projects/voip_support/trunk/control_interface/includes/database.inc on line 235.
   * warning: implode() [function.implode]: Bad arguments. in /data/projects/voip_support/trunk/control_interface/includes/database.inc on line 235.
   * warning: array_keys() [function.array-keys]: The first argument should be an array in /data/projects/voip_support/trunk/control_interface/modules/user/user.module on line 500.
   * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT p.perm FROM web_role r INNER JOIN web_permission p ON p.rid = r.rid WHERE r.rid IN () in /data/projects/voip_support/trunk/control_interface/modules/user/user.module on line 500.
   * ==========================================================
   * The probable reason is $account->role is not assigned when user_access() is called. Note that I called this in hook_user implementation which is called before all the node elements are loaded.
   */
  if(!is_array($account->roles)) {
    return FALSE;
  }
  if($account->uid == 1) {
    return FALSE; /* forbid the admin user.. */
  }
  if(!user_access("can be queue member", $account)) {
    return FALSE;
  }
  if($account->uid == $user->uid || user_access("administer users", $user)) {
    return TRUE;
  }
  return FALSE;
}

