Merged MDL-14483 from 1.9: Use the recipient language to send email

This commit is contained in:
moodler 2008-04-23 02:27:37 +00:00
parent c79106c4b5
commit f49edc81d6

View File

@ -928,7 +928,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
@ -994,6 +1001,8 @@ function message_post_message($userfrom, $userto, $message, $format, $messagetyp
}
}
$USER->lang = $savelang; // restore original language
return $savemessage->id;
}