Skip to content

Commit

Permalink
Merge branch 'wip-mdl-29534-m23' of git://github.com/rajeshtaneja/moo…
Browse files Browse the repository at this point in the history
…dle into MOODLE_23_STABLE
  • Loading branch information
danpoltawski committed Jan 17, 2013
2 parents 4c4ade1 + 532da94 commit 92a3802
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions mod/forum/lib.php
Expand Up @@ -710,6 +710,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;
Expand All @@ -720,11 +728,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".
Expand Down

0 comments on commit 92a3802

Please sign in to comment.