You are here

function og_membership_delete_by_gid in Organic groups 7

Delete all group memberships by group ID.

1 call to og_membership_delete_by_gid()
OgGroup::delete in ./og.module
Permanently deletes the entity.

File

./og.module, line 1192
Enable users to create and manage groups with roles and permissions.

Code

function og_membership_delete_by_gid($gid) {
  $query = new EntityFieldQuery();
  $result = $query
    ->entityCondition('entity_type', 'og_membership')
    ->propertyCondition('gid', $gid, '=')
    ->execute();
  if (!empty($result['og_membership'])) {
    og_membership_delete_multiple(array_keys($result['og_membership']));
  }
}