aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_user.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-10-20 13:48:44 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-10-20 13:48:44 +0000
commitf4da66a9328d12a3a5cb3a36feb184a4686ca2f3 (patch)
tree85fe8abffa4507ce66c4a52e241a58bc5f454353 /phpBB/includes/functions_user.php
parentb572e0db8f18d36d71c7ad645839bb9b0cdb5f38 (diff)
downloadforums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.tar
forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.tar.gz
forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.tar.bz2
forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.tar.xz
forums-f4da66a9328d12a3a5cb3a36feb184a4686ca2f3.zip
- adjust unread query a bit to cope with large topics (thanks bart!)
- fixing some bugs - more username_clean work git-svn-id: file:///svn/phpbb/trunk@6513 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r--phpBB/includes/functions_user.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index f851fde3e0..8f7aa4d78d 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -291,6 +291,23 @@ function user_delete($mode, $user_id, $post_username = false)
SET topic_last_poster_id = ' . ANONYMOUS . ", topic_last_poster_name = '" . $db->sql_escape($post_username) . "', topic_last_poster_colour = ''
WHERE topic_last_poster_id = $user_id";
$db->sql_query($sql);
+
+ // Since we change every post by this author, we need to count this amount towards the anonymous user
+ $sql = 'SELECT user_posts
+ FROM ' . USERS_TABLE . '
+ WHERE user_id = ' . $user_id;
+ $result = $db->sql_query($sql);
+ $num_posts = (int) $db->sql_fetchfield('user_posts');
+ $db->sql_freeresult($result);
+
+ // Update the post count for the anonymous user
+ if ($num_posts)
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_posts = user_posts + ' . $num_posts . '
+ WHERE user_id = ' . ANONYMOUS;
+ $db->sql_query($sql);
+ }
break;
case 'remove':