diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-03-12 15:56:30 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-03-12 15:56:30 +0000 |
commit | 2c3c1a93030bf62ccc2d4a3386b756f01b672d94 (patch) | |
tree | a491665a772f1f99b23f1766f1b3ae749be91641 /modules/user/user.api.php | |
parent | 160b42812c2ec0a32fcdcd02f32d3f86e549fac7 (diff) | |
download | brdo-2c3c1a93030bf62ccc2d4a3386b756f01b672d94.tar.gz brdo-2c3c1a93030bf62ccc2d4a3386b756f01b672d94.tar.bz2 |
- Patch #705306 by moshe weitzman: user_cancel_delete() method calls into a 'standard' user_delete_multiple() API.
Diffstat (limited to 'modules/user/user.api.php')
-rw-r--r-- | modules/user/user.api.php | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/modules/user/user.api.php b/modules/user/user.api.php index 6f818688d..07f28611c 100644 --- a/modules/user/user.api.php +++ b/modules/user/user.api.php @@ -32,11 +32,29 @@ function hook_user_load($users) { } /** + * Respond to user deletion. + * + * This hook is invoked from user_delete_multiple() after the account has been + * removed from the user tables in the database, and before + * field_attach_delete() is called. + * + * @param $account + * The account that is being deleted. + * + * @see user_delete_multiple() + */ +function hook_user_delete($account) { + db_delete('mytable') + ->condition('uid', $account->uid) + ->execute(); +} + +/** * Act on user account cancellations. * * The user account is being canceled. Depending on the account cancellation - * method, the module should either do nothing, unpublish content, anonymize - * content, or delete content and data belonging to the canceled user account. + * method, the module should either do nothing, unpublish content, or anonymize + * content. * * Expensive operations should be added to the global batch with batch_set(). * @@ -83,26 +101,6 @@ function hook_user_cancel($edit, $account, $method) { ->condition('uid', $account->uid) ->execute(); break; - - case 'user_cancel_delete': - // Delete nodes (current revisions). - $nodes = db_select('node', 'n') - ->fields('n', array('nid')) - ->condition('uid', $account->uid) - ->execute() - ->fetchCol(); - foreach ($nodes as $nid) { - node_delete($nid); - } - // Delete old revisions. - db_delete('node_revision') - ->condition('uid', $account->uid) - ->execute(); - // Clean history. - db_delete('history') - ->condition('uid', $account->uid) - ->execute(); - break; } } |