Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Created November 4, 2012 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitaibu/4011300 to your computer and use it in GitHub Desktop.
Save amitaibu/4011300 to your computer and use it in GitHub Desktop.
$gids = og_get_entity_groups('user', $account);
if (empty($gids['node'])) {
return;
}
// Query flag to see if subscribing to any given groups.
// $gids['node'];
if (!$result) {
return;
}
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'og_membership')
->propertyCondition('group_type', 'node')
->propertyCondition('gid', $gids['node'], 'IN')
->propertyCondition('entity_type', 'node', '=')
->execute();
return !empty($result['node']) ? array_keys($result['node']) : FALSE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment