diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 99022adeac0..dc97698545e 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -455,12 +455,14 @@ function forum_cron() { 'List-Id: "'.$cleanforumname.'" id.'@'.$hostname.'>', 'List-Help: '.$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id, 'Message-ID: id.'@'.$hostname.'>', - 'In-Reply-To: parent.'@'.$hostname.'>', - 'References: parent.'@'.$hostname.'>', 'X-Course-Id: '.$course->id, 'X-Course-Name: '.format_string($course->fullname, true) ); + if ($post->parent) { // This post is a reply, so add headers for threading (see MDL-22551) + $userfrom->customheaders[] = 'In-Reply-To: parent.'@'.$hostname.'>'; + $userfrom->customheaders[] = 'References: parent.'@'.$hostname.'>', + } $postsubject = "$course->shortname: ".format_string($post->subject,true); $posttext = forum_make_mail_text($course, $forum, $discussion, $post, $userfrom, $userto);