diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 7900ba398bb..0c959b29564 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1727,19 +1727,18 @@ function forum_get_course_forum($courseid, $type) { function forum_make_mail_post(&$post, $user, $touser, $course, $ownpost=false, $reply=false, $link=false, $rate=false, $footer="") { -// Given the data about a posting, builds up the HTML to display it and -// returns the HTML in a string. This is designed for sending via HTML email. + + // Given the data about a posting, builds up the HTML to display it and + // returns the HTML in a string. This is designed for sending via HTML email. global $CFG; static $formattedtext; // Cached version of formatted text for a post static $formattedtextid; // The ID number of the post - - if (!$forum = get_record('forum', 'id', $post->discussion)) { - mtrace('Could not get the forum for the discussion the post belongs to'); - } - if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) { + $post->forum = get_field('forum_discussions', 'forum', 'id', $post->discussion); + + if (!$cm = get_coursemodule_from_instance('forum', $post->forum)) { mtrace('Course Module ID was incorrect'); } $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id); @@ -1765,7 +1764,7 @@ function forum_make_mail_post(&$post, $user, $touser, $course, } $output .= '