summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-26 19:31:00 +0000
committerGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-03-26 19:31:00 +0000
commit5885925b0d2881277c22c6d70d86f1bc060fb133 (patch)
tree828d46033a71340a7edc2bc71133767e4b105920
parente01c325d4ff7adc07d552907f7fb7fdddc56f9b0 (diff)
downloadbrdo-5885925b0d2881277c22c6d70d86f1bc060fb133.tar.gz
brdo-5885925b0d2881277c22c6d70d86f1bc060fb133.tar.bz2
#53348, Handling of deleted/blocked user accounts, patch by jreyero and Zen
-rw-r--r--modules/comment.module4
-rw-r--r--modules/comment/comment.module4
-rw-r--r--modules/node.module10
-rw-r--r--modules/node/node.module10
-rw-r--r--modules/poll.module9
-rw-r--r--modules/poll/poll.module9
-rw-r--r--modules/profile.module2
-rw-r--r--modules/profile/profile.module2
-rw-r--r--modules/statistics.module9
-rw-r--r--modules/statistics/statistics.module9
-rw-r--r--modules/user.module2
-rw-r--r--modules/user/user.module2
-rw-r--r--modules/watchdog.module9
-rw-r--r--modules/watchdog/watchdog.module9
14 files changed, 88 insertions, 2 deletions
diff --git a/modules/comment.module b/modules/comment.module
index f7c9383f0..1b6a17217 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 f7c9383f0..1b6a17217 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 ec8a58180..ebe013b93 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 ec8a58180..ebe013b93 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 1cd9fce8b..7d452d5f4 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 1cd9fce8b..7d452d5f4 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 1e4845dff..d08b8be94 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 1e4845dff..d08b8be94 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 9eaccd6fe..1c79db602 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 9eaccd6fe..1c79db602 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 7527b7794..762a54422 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 7527b7794..762a54422 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 7bd72f8ae..71f353d7f 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -62,6 +62,15 @@ function watchdog_cron() {
}
/**
+ * 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.
*/
function watchdog_overview() {
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 7bd72f8ae..71f353d7f 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -62,6 +62,15 @@ function watchdog_cron() {
}
/**
+ * 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.
*/
function watchdog_overview() {