Skip to content

Commit

Permalink
Merged MDL-14483 from 1.9 Use the recipient language to send email
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Apr 23, 2008
1 parent 9c2e402 commit 5fe4496
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,14 @@ function message_format_message(&$message, &$user, $format='', $keywords='', $cl
*/
function message_post_message($userfrom, $userto, $message, $format, $messagetype) {

global $CFG, $SITE;
global $CFG, $SITE, $USER;

/// Set up current language to suit the receiver of the message
$savelang = $USER->lang;

if (!empty($userto->lang)) {
$USER->lang = $userto->lang;
}

/// Save the new message in the database

Expand Down Expand Up @@ -1047,6 +1054,8 @@ function message_post_message($userfrom, $userto, $message, $format, $messagetyp
}
}

$USER->lang = $savelang; // restore original language

return $savemessage->id;
}

Expand Down

0 comments on commit 5fe4496

Please sign in to comment.