function og_entity_delete in Organic groups 7.2
Same name and namespace in other branches
- 8 og.module \og_entity_delete()
- 7 og.module \og_entity_delete()
Implements hook_entity_delete().
File
- ./
og.module, line 962 - Enable users to create and manage groups with roles and permissions.
Code
function og_entity_delete($entity, $entity_type) {
list($id, , $bundle) = entity_extract_ids($entity_type, $entity);
if (og_is_group($entity_type, $entity)) {
og_delete_user_roles_by_group($entity_type, $entity);
og_membership_delete_by_group($entity_type, $entity);
}
if (og_is_group_content_type($entity_type, $bundle)) {
// As the field attachers are called after hook_entity_presave() we
// can't delete the OG memberships here. So we just mark the entity
// as being deleted, and we will do the actual delete in
// OgBehaviorHandler::delete().
$entity->delete_og_membership = TRUE;
}
}