From 3d68b9e954a1b140440d117321cc277fa99ad2a7 Mon Sep 17 00:00:00 2001 From: Isaac Marco Blancas Date: Tue, 8 Jan 2013 16:10:57 +0800 Subject: [PATCH 1/2] MDL-29534 Forum: If forum_replytouser is not set then don't display from user email" --- mod/forum/lib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index b515244f3b7..8f1e2576ad6 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -720,6 +720,11 @@ function forum_cron() { $eventdata->contexturl = "{$CFG->wwwroot}/mod/forum/discuss.php?d={$discussion->id}#p{$post->id}"; $eventdata->contexturlname = $discussion->name; + // If forum_replytouser is not set then set mail display to 0. + if (!$CFG->forum_replytouser) { + $eventdata->userfrom->maildisplay = 0; + } + $mailresult = message_send($eventdata); if (!$mailresult){ mtrace("Error: mod/forum/lib.php forum_cron(): Could not send out mail for id $post->id to user $userto->id". @@ -1014,7 +1019,7 @@ function forum_cron() { $usetrueaddress = true; // Directly email forum digests rather than sending them via messaging, use the // site shortname as 'from name', the noreply address will be used by email_to_user. - $mailresult = email_to_user($userto, $site->shortname, $postsubject, $posttext, $posthtml, $attachment, $attachname, $usetrueaddress, $CFG->forum_replytouser); + $mailresult = email_to_user($userto, $site->shortname, $postsubject, $posttext, $posthtml, $attachment, $attachname, $usetrueaddress); if (!$mailresult) { mtrace("ERROR!"); From 20b556afa17f55dcc9ec211e203c48a61fab570b Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Tue, 8 Jan 2013 16:15:25 +0800 Subject: [PATCH 2/2] MDL-29534 Forum: if forum_replytouser is not set then send forum email using noreplyaddress. --- mod/forum/lib.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 8f1e2576ad6..4e0d5fbe049 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -720,9 +720,9 @@ function forum_cron() { $eventdata->contexturl = "{$CFG->wwwroot}/mod/forum/discuss.php?d={$discussion->id}#p{$post->id}"; $eventdata->contexturlname = $discussion->name; - // If forum_replytouser is not set then set mail display to 0. - if (!$CFG->forum_replytouser) { - $eventdata->userfrom->maildisplay = 0; + // If forum_replytouser is not set then send mail using the noreplyaddress. + if (empty($CFG->forum_replytouser)) { + $eventdata->userfrom->email = $CFG->noreplyaddress; } $mailresult = message_send($eventdata); @@ -1016,10 +1016,9 @@ function forum_cron() { } $attachment = $attachname=''; - $usetrueaddress = true; // Directly email forum digests rather than sending them via messaging, use the // site shortname as 'from name', the noreply address will be used by email_to_user. - $mailresult = email_to_user($userto, $site->shortname, $postsubject, $posttext, $posthtml, $attachment, $attachname, $usetrueaddress); + $mailresult = email_to_user($userto, $site->shortname, $postsubject, $posttext, $posthtml, $attachment, $attachname); if (!$mailresult) { mtrace("ERROR!");