aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorCallum Macrae <callumacrae95@gmail.com>2011-02-24 22:12:36 +0000
committerCallum Macrae <callumacrae95@gmail.com>2011-02-24 22:36:35 +0000
commit9399c7c46bd4e895a06127c19b27155008946726 (patch)
tree6e59003e7a9b1d09e48211b215b933078975d45c /phpBB
parent5e2bbdb22b82102c9bb2a1f040ad2755e545941e (diff)
downloadforums-9399c7c46bd4e895a06127c19b27155008946726.tar
forums-9399c7c46bd4e895a06127c19b27155008946726.tar.gz
forums-9399c7c46bd4e895a06127c19b27155008946726.tar.bz2
forums-9399c7c46bd4e895a06127c19b27155008946726.tar.xz
forums-9399c7c46bd4e895a06127c19b27155008946726.zip
[ticket/7834] Topic time didn't update when first post was deleted
When the first post of a topic was deleted, the topic time didn't update - it should have changed to the time of the next post. This commit simply applies lefty74's patch posted in the ticket. It gets the post time of the next post from the database, and updates the thread accordingly. This patch is not my work at all and all credits go to lefty74, I just transferred it onto GitHub PHPBB3-7834
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_posting.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 72331a73c6..271039f415 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1479,7 +1479,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
break;
case 'delete_first_post':
- $sql = 'SELECT p.post_id, p.poster_id, p.post_username, u.username, u.user_colour
+ $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
@@ -1493,7 +1493,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : '';
}
- $sql_data[TOPICS_TABLE] = 'topic_poster = ' . intval($row['poster_id']) . ', topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_colour = '" . $db->sql_escape($row['user_colour']) . "', topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'";
+ $sql_data[TOPICS_TABLE] = 'topic_poster = ' . intval($row['poster_id']) . ', topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_colour = '" . $db->sql_escape($row['user_colour']) . "', topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "', topic_time = " . (int) $row['post_time'];
// Decrementing topic_replies here is fine because this case only happens if there is more than one post within the topic - basically removing one "reply"
$sql_data[TOPICS_TABLE] .= ', topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : '');