function spaces_og_get_users in Spaces 5.2
Same name and namespace in other branches
- 6 spaces_og/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.
3 calls to spaces_og_get_users()
- spaces_casetracker_user_options in spaces_casetracker/
spaces_casetracker.module - Build option array of users in the current group
- spaces_dashboard_users in spaces_dashboard/
spaces_dashboard.module - _spaces_contacts_users in spaces_contacts/
spaces_contacts.module - Wrapper around spaces_og_get_users() that provides additional support for vcard name fields
File
- ./
spaces_og.module, line 912
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;
}