Permalink
Browse files

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

  • Loading branch information...
1 parent 9c2e402 commit 5fe44967f805688c596a1970ae7e0e9295fabda6 moodler committed Apr 23, 2008
Showing with 10 additions and 1 deletion.
  1. +10 −1 message/lib.php
View
11 message/lib.php
@@ -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
@@ -1047,6 +1054,8 @@ function message_post_message($userfrom, $userto, $message, $format, $messagetyp
}
}
+ $USER->lang = $savelang; // restore original language
+
return $savemessage->id;
}

0 comments on commit 5fe4496

Please sign in to comment.