Permalink
Browse files

Merge branch 'wip-mdl-29534-m24' of git://github.com/rajeshtaneja/moo…

…dle into MOODLE_24_STABLE
  • Loading branch information...
2 parents c21089c + e8835af commit cf75be653bcb32fe927bb91d97836fbe34f5136d @danpoltawski danpoltawski committed Jan 17, 2013
Showing with 8 additions and 5 deletions.
  1. +8 −5 mod/forum/lib.php
View
13 mod/forum/lib.php
@@ -705,6 +705,14 @@ function forum_cron() {
$eventdata->fullmessagehtml = $posthtml;
$eventdata->notification = 1;
+ // If forum_replytouser is not set then send mail using the noreplyaddress.
+ if (empty($CFG->forum_replytouser)) {
+ // Clone userfrom as it is referenced by $users.
+ $cloneduserfrom = clone($userfrom);
+ $cloneduserfrom->email = $CFG->noreplyaddress;
+ $eventdata->userfrom = $cloneduserfrom;
+ }
+
$smallmessagestrings = new stdClass();
$smallmessagestrings->user = fullname($userfrom);
$smallmessagestrings->forumname = "$shortname: ".format_string($forum->name,true).": ".$discussion->name;
@@ -715,11 +723,6 @@ 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 send mail using the noreplyaddress.
- if (empty($CFG->forum_replytouser)) {
- $eventdata->userfrom->email = $CFG->noreplyaddress;
- }
-
$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".

0 comments on commit cf75be6

Please sign in to comment.