You are here

function oa_core_get_orphans in Open Atrium Core 7.2

Find if any orphans.

1 call to oa_core_get_orphans()
oa_core_form_node_delete_confirm_alter in ./oa_core.module
Implements hook_form_alter().

File

./oa_core.module, line 702

Code

function oa_core_get_orphans($group_type, $gid, $max = 1) {
  $query = new EntityFieldQuery();
  $result = $query
    ->entityCondition('entity_type', 'og_membership')
    ->propertyCondition('group_type', $group_type, '=')
    ->propertyCondition('gid', $gid, '=')
    ->propertyCondition('entity_type', 'user', '!=')
    ->propertyOrderBy('id')
    ->range(0, $max)
    ->execute();
  return !empty($result['og_membership']) ? og_membership_load_multiple(array_keys($result['og_membership'])) : array();
}