function hook_user_predelete

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

3 functions implement hook_user_predelete()

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

comment_user_predelete in drupal/core/modules/comment/comment.module
Implements hook_user_predelete().
entity_crud_hook_test_user_predelete in drupal/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
Implements hook_user_predelete().
node_user_predelete in drupal/core/modules/node/node.module
Implements hook_user_predelete().

File

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

Code

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