function oa_core_get_inherited_users_for_space in Open Atrium Core 7.2
Get the users that are in a space, including inherited users.
Parameters
int $space_id: The NID of the Space.
int $state: (Optional) The state of the OG membership, for example:
- OG_STATE_ACTIVE (the default)
- OG_STATE_PENDING
- OG_STATE_BLOCKED
Return value
array An associative array of fully loaded user objects, keyed by user id.
File
- includes/
oa_core.util.inc, line 1091 - Code for Utility functions for OpenAtrium spaces
Code
function oa_core_get_inherited_users_for_space($space_id, $state = OG_STATE_ACTIVE) {
$users = oa_core_get_users_for_space($space_id, $state);
if (module_exists('og_subgroups') && function_exists('_og_subgroups_get_inherited_users')) {
$inherited_users = _og_subgroups_get_inherited_users('node', $space_id);
foreach ($inherited_users as $uid => $data) {
foreach ($data as $item) {
if ($item['membership']->state == $state) {
$users[$uid] = $item['user'];
}
}
}
}
return $users;
}