function registration_user_delete in Entity Registration 7
Same name and namespace in other branches
- 8 registration.module \registration_user_delete()
Implements hook_user_delete().
File
- ./
registration.module, line 494
Code
function registration_user_delete($account) {
if (isset($account->uid)) {
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'registration')
->propertyCondition('author_uid', $account->uid)
->execute();
if ($result) {
registration_delete_multiple(array_keys($result['registration']));
}
// Users associated with {registration}.user_uid do not own the
// registration. Simply disassociate the user with the registration.
db_update('registration')
->fields(array(
'user_uid' => NULL,
))
->condition('user_uid', $account->uid)
->execute();
// Delete entries in the cache as well.
cache_clear_all('*', 'cache_entity_registration', TRUE);
}
}