diff options
Diffstat (limited to 'phpBB/includes/mcp/mcp_post.php')
-rw-r--r-- | phpBB/includes/mcp/mcp_post.php | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index d226a0b545..106af1e2ed 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -362,20 +362,23 @@ function change_poster(&$post_info, $userdata) markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']); // Remove the dotted topic option if the old user has no more posts within this topic - $sql = 'SELECT topic_id - FROM ' . POSTS_TABLE . ' - WHERE topic_id = ' . $post_info['topic_id'] . ' - AND poster_id = ' . $post_info['user_id']; - $result = $db->sql_query_limit($sql, 1); - $topic_id = (int) $db->sql_fetchfield('topic_id'); - $db->sql_freeresult($result); - - if (!$topic_id) + if ($config['load_db_track'] && $post_info['user_id'] != ANONYMOUS) { - $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' - WHERE user_id = ' . $post_info['user_id'] . ' - AND topic_id = ' . $post_info['topic_id']; - $db->sql_query($sql); + $sql = 'SELECT topic_id + FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . $post_info['topic_id'] . ' + AND poster_id = ' . $post_info['user_id']; + $result = $db->sql_query_limit($sql, 1); + $topic_id = (int) $db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); + + if (!$topic_id) + { + $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' + WHERE user_id = ' . $post_info['user_id'] . ' + AND topic_id = ' . $post_info['topic_id']; + $db->sql_query($sql); + } } // Do not change the poster_id within the attachments table, since they were still posted by the original user |