diff --git a/modules/comment.module b/modules/comment.module index f7c9383f0c5266f41e4eac456d54b6a2734438c9..1b6a172176e16a61db68021f471d5452e04f4cc5 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -335,6 +335,10 @@ function comment_user($type, $edit, &$user, $category = NULL) { return $form; } + elseif ($type == 'delete') { + db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $user->uid); + db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $user->uid); + } } /** diff --git a/modules/comment/comment.module b/modules/comment/comment.module index f7c9383f0c5266f41e4eac456d54b6a2734438c9..1b6a172176e16a61db68021f471d5452e04f4cc5 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -335,6 +335,10 @@ function comment_user($type, $edit, &$user, $category = NULL) { return $form; } + elseif ($type == 'delete') { + db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $user->uid); + db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $user->uid); + } } /** diff --git a/modules/node.module b/modules/node.module index ec8a58180e25e6a1627022c3737be88288b55641..ebe013b93b9a34291570c578fa67824ce4a34d73 100644 --- a/modules/node.module +++ b/modules/node.module @@ -822,6 +822,16 @@ function node_search($op = 'search', $keys = null) { } } +/** + * Implementation of hook_user(). + */ +function node_user($op, &$edit, &$user) { + if ($op == 'delete') { + db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid); + db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid); + } +} + function theme_node_search_admin($form) { $output = form_render($form['info']); diff --git a/modules/node/node.module b/modules/node/node.module index ec8a58180e25e6a1627022c3737be88288b55641..ebe013b93b9a34291570c578fa67824ce4a34d73 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -822,6 +822,16 @@ function node_search($op = 'search', $keys = null) { } } +/** + * Implementation of hook_user(). + */ +function node_user($op, &$edit, &$user) { + if ($op == 'delete') { + db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid); + db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid); + } +} + function theme_node_search_admin($form) { $output = form_render($form['info']); diff --git a/modules/poll.module b/modules/poll.module index 1cd9fce8ba3242415e2e842d9fe0b14a864195f7..7d452d5f44be59d9ec036cf63d7a5cdbdfc6c067 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -492,3 +492,12 @@ function poll_update($node) { } } } + +/** + * Implementation of hook_user(). + */ +function poll_user($op, &$edit, &$user) { + if ($op == 'delete') { + db_query('UPDATE {poll_votes} SET uid = 0 WHERE uid = %d', $user->uid); + } +} diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 1cd9fce8ba3242415e2e842d9fe0b14a864195f7..7d452d5f44be59d9ec036cf63d7a5cdbdfc6c067 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -492,3 +492,12 @@ function poll_update($node) { } } } + +/** + * Implementation of hook_user(). + */ +function poll_user($op, &$edit, &$user) { + if ($op == 'delete') { + db_query('UPDATE {poll_votes} SET uid = 0 WHERE uid = %d', $user->uid); + } +} diff --git a/modules/profile.module b/modules/profile.module index 1e4845dff11a34191a498eee876739a3c856a80e..d08b8be9407907b02d1544fa6da0590db83aca68 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -165,6 +165,8 @@ function profile_user($type, &$edit, &$user, $category = NULL) { return profile_validate_profile($edit, $category); case 'categories': return profile_categories(); + case 'delete': + db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid); } } diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 1e4845dff11a34191a498eee876739a3c856a80e..d08b8be9407907b02d1544fa6da0590db83aca68 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -165,6 +165,8 @@ function profile_user($type, &$edit, &$user, $category = NULL) { return profile_validate_profile($edit, $category); case 'categories': return profile_categories(); + case 'delete': + db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid); } } diff --git a/modules/statistics.module b/modules/statistics.module index 9eaccd6fe8af198c9247e0191f37cf2bbfb5f741..1c79db6028d67ef64ebc24d2d1c44b7241134d15 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -145,6 +145,15 @@ function statistics_menu($may_cache) { return $items; } +/** + * Implementation of hook_user(). + */ +function statistics_user($op, &$edit, &$user) { + if ($op == 'delete') { + db_query('UPDATE {accesslog} SET uid = 0 WHERE uid = %d', $user->uid); + } +} + function statistics_access_log($aid) { $result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = %d', $aid); if ($access = db_fetch_object($result)) { diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 9eaccd6fe8af198c9247e0191f37cf2bbfb5f741..1c79db6028d67ef64ebc24d2d1c44b7241134d15 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -145,6 +145,15 @@ function statistics_menu($may_cache) { return $items; } +/** + * Implementation of hook_user(). + */ +function statistics_user($op, &$edit, &$user) { + if ($op == 'delete') { + db_query('UPDATE {accesslog} SET uid = 0 WHERE uid = %d', $user->uid); + } +} + function statistics_access_log($aid) { $result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = %d', $aid); if ($access = db_fetch_object($result)) { diff --git a/modules/user.module b/modules/user.module index 7527b77947aacd2a6d2f9422c0588a86d3050995..762a5442226e28dba2ab9475584b99f336c936a8 100644 --- a/modules/user.module +++ b/modules/user.module @@ -1369,7 +1369,7 @@ function user_edit($category = 'account') { drupal_goto('admin/user'); } else { - return confirm_form('user_confirm_delete', $form, t('Are you sure you want to delete the account %name?', array('%name' => theme('placeholder', $account->name))), 'user/'. $account->uid, t('Deleting a user will remove all their submissions as well. This action cannot be undone.'), t('Delete')); + return confirm_form('user_confirm_delete', array(), t('Are you sure you want to delete the account %name?', array('%name' => theme('placeholder', $account->name))), 'user/'. $account->uid, t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), t('Delete'), t('Cancel')); } } else if ($_POST['op'] == t('Delete')) { diff --git a/modules/user/user.module b/modules/user/user.module index 7527b77947aacd2a6d2f9422c0588a86d3050995..762a5442226e28dba2ab9475584b99f336c936a8 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1369,7 +1369,7 @@ function user_edit($category = 'account') { drupal_goto('admin/user'); } else { - return confirm_form('user_confirm_delete', $form, t('Are you sure you want to delete the account %name?', array('%name' => theme('placeholder', $account->name))), 'user/'. $account->uid, t('Deleting a user will remove all their submissions as well. This action cannot be undone.'), t('Delete')); + return confirm_form('user_confirm_delete', array(), t('Are you sure you want to delete the account %name?', array('%name' => theme('placeholder', $account->name))), 'user/'. $account->uid, t('All submissions made by this user will be attributed to the anonymous account. This action cannot be undone.'), t('Delete'), t('Cancel')); } } else if ($_POST['op'] == t('Delete')) { diff --git a/modules/watchdog.module b/modules/watchdog.module index 7bd72f8ae803ded26ce602664f89fd273f6d94b0..71f353d7f3187fabbfe1c7479121b550e59cd832 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -61,6 +61,15 @@ function watchdog_cron() { db_query('DELETE FROM {flood} WHERE timestamp < %d', time() - 3600); } +/** + * Implementation of hook_user(). + */ +function watchdog_user($op, &$edit, &$user) { + if ($op == 'delete') { + db_query('UPDATE {watchdog} SET uid=0 WHERE uid=%d', $user->uid); + } +} + /** * Menu callback; displays a listing of log messages. */ diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index 7bd72f8ae803ded26ce602664f89fd273f6d94b0..71f353d7f3187fabbfe1c7479121b550e59cd832 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -61,6 +61,15 @@ function watchdog_cron() { db_query('DELETE FROM {flood} WHERE timestamp < %d', time() - 3600); } +/** + * Implementation of hook_user(). + */ +function watchdog_user($op, &$edit, &$user) { + if ($op == 'delete') { + db_query('UPDATE {watchdog} SET uid=0 WHERE uid=%d', $user->uid); + } +} + /** * Menu callback; displays a listing of log messages. */