You are here

function spaces_get_users in Spaces 5

Get drupal users

Parameters

$exclude_system: Bool, whether to exclude system user - ie user 1

Return value

Array of user objects, where key is uid.

2 calls to spaces_get_users()
spaces_dashboard_users in spaces_dashboard/spaces_dashboard.module
_spaces_contacts_users in spaces_contacts/spaces_contacts.module
Wrapper around spaces_get_users() that provides additional support for vcard name fields

File

./spaces.module, line 1116

Code

function spaces_get_users($exclude_system = true, $active_only = true, $group_only = true, $pager = 0) {
  $args[] = $exclude_system ? 1 : 0;
  $args[] = $active_only ? 1 : 0;
  if (($gid = spaces_gid()) && $group_only) {
    $join = 'JOIN {og_uid} ogu ON u.uid = ogu.uid';
    $where = 'AND ogu.nid = %d';
    $args[] = $gid;
  }
  if ($pager == 0) {
    $result = db_query("SELECT u.uid, u.name, u.mail, u.picture, u.status FROM {users} u {$join} WHERE u.uid > %d AND u.status >= %d {$where} ORDER BY name", $args);
  }
  else {
    $result = pager_query("SELECT u.uid, u.name, u.mail, u.picture, u.status FROM {users} u {$join} WHERE u.uid > %d AND u.status >= %d {$where} ORDER BY name", $pager, 0, null, $args);
  }
  $users = array();
  while ($u = db_fetch_object($result)) {
    $users[$u->uid] = $u;
  }
  return $users;
}