From ee95b9c319578d840aa014ad2a7d8560f00b036e Mon Sep 17 00:00:00 2001 From: Michael Hawkins Date: Fri, 14 Dec 2018 17:21:24 +0800 Subject: [PATCH] MDL-63892 mod_forum: Fix last post details in forum view --- mod/forum/lib.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 11d5b871a89..577e713cd7c 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -3925,7 +3925,7 @@ function forum_print_discussion_header(&$post, $forum, $group = -1, $datestring } echo ''; - $usedate = (empty($post->created)) ? $post->timemodified : $post->created; + $usedate = (empty($post->timemodified)) ? $post->created : $post->timemodified; $parenturl = ''; $usermodified = new stdClass(); $usermodified->id = $post->usermodified; @@ -4558,10 +4558,6 @@ function forum_update_post($newpost, $mform, $unused = null) { } $post->modified = time(); - // Last post modified tracking. - $discussion->timemodified = $post->modified; - $discussion->usermodified = $post->userid; - if (!$post->parent) { // Post is a discussion starter - update discussion title and times too $discussion->name = $post->subject; $discussion->timestart = $post->timestart; @@ -4574,6 +4570,7 @@ function forum_update_post($newpost, $mform, $unused = null) { $post->message = file_save_draft_area_files($newpost->itemid, $context->id, 'mod_forum', 'post', $post->id, mod_forum_post_form::editor_options($context, $post->id), $post->message); $DB->update_record('forum_posts', $post); + // Note: Discussion modified time/user are intentionally not updated, to enable them to track the latest new post. $DB->update_record('forum_discussions', $discussion); forum_add_attachment($post, $forum, $cm, $mform);