1 user.api.php hook_user_predelete($account)

Act before user deletion.

This hook is invoked from user_delete_multiple() before field_attach_delete() is called and before the user is 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 about to be deleted.

See also

hook_user_delete()

user_delete_multiple()

Related topics

File

core/modules/user/user.api.php, line 48
Hooks provided by the User module.

Code

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