aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 97fc9ba73b..042e0bae03 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -659,8 +659,14 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
foreach ($post_counts as $poster_id => $substract)
{
$sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_posts = 0
+ WHERE user_id = ' . $poster_id . '
+ AND user_posts < ' . $substract;
+ $db->sql_query($sql);
+ $sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = user_posts - ' . $substract . '
- WHERE user_id = ' . $poster_id;
+ WHERE user_id = ' . $poster_id . '
+ AND user_posts >= ' . $substract;
$db->sql_query($sql);
}
}