hook_user_delete

  1. drupal
    1. 8
    2. 7
Versions
8 – 7 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

Code

modules/user/user.api.php, line 47

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