function hook_user_delete

7.x user.api.php hook_user_delete($account)

Respond to user deletion.

This hook is invoked from user_delete_multiple() before field_attach_delete() is called and before users are actually removed from the database.

Modules should additionally implement hook_user_cancel() to process stored user data for other account cancellation methods.

Parameters

$account: The account that is being deleted.

See also

user_delete_multiple()

Related topics

7 functions implement hook_user_delete()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

comment_user_delete in drupal/modules/comment/comment.module
Implements hook_user_delete().
entity_crud_hook_test_user_delete in drupal/modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_user_delete().
node_user_delete in drupal/modules/node/node.module
Implements hook_user_delete().
poll_user_delete in drupal/modules/poll/poll.module
Implements hook_user_delete().
profile_user_delete in drupal/modules/profile/profile.module
Implements hook_user_delete().

... See full list

4 invocations of hook_user_delete()
field_attach_delete in drupal/modules/field/field.attach.inc
Delete field data for an existing entity. This deletes all revisions of field data for the entity.
field_purge_data in drupal/modules/field/field.crud.inc
Purges the field data for a single field on a single pseudo-entity.
node_delete_multiple in drupal/modules/node/node.module
Deletes multiple nodes.
user_delete_multiple in drupal/modules/user/user.module
Delete multiple user accounts.

File

drupal/modules/user/user.api.php, line 47
Hooks provided by the User module.

Code

function hook_user_delete($account) {
  db_delete('mytable')->condition('uid', $account->uid)->execute();
}