function spaces_og_get_users in Spaces 6
Same name and namespace in other branches
- 5.2 spaces_og.module \spaces_og_get_users()
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.
File
- spaces_og/
spaces_og.module, line 984
Code
function spaces_og_get_users($exclude_system = true, $active_only = true, $group_only = true, $pager = 0) {
$args[] = $exclude_system ? 1 : 0;
$args[] = $active_only ? 1 : 0;
if ($group_only && ($space = spaces_get_space())) {
$join = 'JOIN {og_uid} ogu ON u.uid = ogu.uid';
$where = 'AND ogu.nid = %d';
$args[] = $space->sid;
}
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;
}