aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_user.php
diff options
context:
space:
mode:
authorCallum Macrae <callumacrae95@gmail.com>2011-02-24 14:13:45 +0000
committerCallum Macrae <callumacrae95@gmail.com>2011-02-24 14:53:44 +0000
commite6219c83c7302424f670d4160798db4952a48f0c (patch)
tree73a93e268084fe403d44784211876eabbbca941b /phpBB/includes/functions_user.php
parent5e2bbdb22b82102c9bb2a1f040ad2755e545941e (diff)
downloadforums-e6219c83c7302424f670d4160798db4952a48f0c.tar
forums-e6219c83c7302424f670d4160798db4952a48f0c.tar.gz
forums-e6219c83c7302424f670d4160798db4952a48f0c.tar.bz2
forums-e6219c83c7302424f670d4160798db4952a48f0c.tar.xz
forums-e6219c83c7302424f670d4160798db4952a48f0c.zip
[ticket/9872] Removed some useless code that broke delete_posts
When in the ACP, there is the option to delete a user and all their posts. This would then call the user_delete function and define $mode as 'remove'. On lines 485-521 was some code that would delete their topics, then after that there would be a call to delete_posts - which would also delete their topics. It would not update the board statistics, and the thread count would remain the same, even though several had been deleted. It stopped delete_topics functioning correctly, so delete_topics would not update the board statistics either. My solution to this is to delete lines 485-521 and allow delete_posts to call delete_topics, thus updating the thread count in the statistics. PHPBB3-9872
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r--phpBB/includes/functions_user.php38
1 files changed, 0 insertions, 38 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 90341cd926..0420aa70ab 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -482,44 +482,6 @@ function user_delete($mode, $user_id, $post_username = false)
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
}
- $sql = 'SELECT topic_id, COUNT(post_id) AS total_posts
- FROM ' . POSTS_TABLE . "
- WHERE poster_id = $user_id
- GROUP BY topic_id";
- $result = $db->sql_query($sql);
-
- $topic_id_ary = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $topic_id_ary[$row['topic_id']] = $row['total_posts'];
- }
- $db->sql_freeresult($result);
-
- if (sizeof($topic_id_ary))
- {
- $sql = 'SELECT topic_id, topic_replies, topic_replies_real
- FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary));
- $result = $db->sql_query($sql);
-
- $del_topic_ary = array();
- while ($row = $db->sql_fetchrow($result))
- {
- if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']])
- {
- $del_topic_ary[] = $row['topic_id'];
- }
- }
- $db->sql_freeresult($result);
-
- if (sizeof($del_topic_ary))
- {
- $sql = 'DELETE FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', $del_topic_ary);
- $db->sql_query($sql);
- }
- }
-
// Delete posts, attachments, etc.
delete_posts('poster_id', $user_id);