mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
message MDL-24972 made sure all strings in messages are in the message recipient's language
This commit is contained in:
parent
8179c167e4
commit
4ffa1463ec
@ -49,9 +49,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function message_send($eventdata) {
|
||||
global $CFG, $DB;
|
||||
|
||||
//TODO: this function is very slow and inefficient, it would be a major bottleneck in cron processing, this has to be improved in 2.0
|
||||
// probably we could add two parameters with user messaging preferences and we could somehow preload/cache them in cron
|
||||
|
||||
//TODO: we need to solve problems with database transactions here somehow, for now we just prevent transactions - sorry
|
||||
$DB->transactions_forbidden();
|
||||
|
||||
|
@ -1552,13 +1552,16 @@ function message_format_message(&$message, &$user, $format='', $keywords='', $cl
|
||||
*/
|
||||
function message_post_message($userfrom, $userto, $message, $format, $messagetype) {
|
||||
global $SITE, $CFG, $USER;
|
||||
|
||||
|
||||
$eventdata = new stdClass();
|
||||
$eventdata->component = 'moodle';
|
||||
$eventdata->name = 'instantmessage';
|
||||
$eventdata->userfrom = $userfrom;
|
||||
$eventdata->userto = $userto;
|
||||
$eventdata->subject = get_string('unreadnewmessage', 'message', fullname($userfrom));
|
||||
|
||||
//using string manager directly so that strings in the message will be in the message recipients language rather than the senders
|
||||
$eventdata->subject = get_string_manager()->get_string('unreadnewmessage', 'message', fullname($userfrom), $userto->lang);
|
||||
|
||||
$eventdata->fullmessage = $message;
|
||||
$eventdata->fullmessageformat = $format;
|
||||
$eventdata->fullmessagehtml = '';
|
||||
@ -1568,7 +1571,7 @@ function message_post_message($userfrom, $userto, $message, $format, $messagetyp
|
||||
$s->sitename = $SITE->shortname;
|
||||
$s->url = $CFG->wwwroot.'/message/index.php?id='.$userfrom->id;//.'&user='.$userto->id;
|
||||
|
||||
$emailtagline = get_string('emailtagline', 'message', $s);
|
||||
$emailtagline = get_string_manager()->get_string('emailtagline', 'message', $s, $userto->lang);
|
||||
if (!empty($eventdata->fullmessage)) {
|
||||
$eventdata->fullmessage .= "\n\n---------------------------------------------------------------------\n".$emailtagline;
|
||||
}
|
||||
|
@ -641,7 +641,8 @@ function forum_cron() {
|
||||
$smallmessagestrings->user = fullname($userfrom);
|
||||
$smallmessagestrings->forumname = "{$course->shortname}: ".format_string($forum->name,true).": ".$discussion->name;
|
||||
$smallmessagestrings->message = $post->message;
|
||||
$eventdata->smallmessage = get_string('smallmessage', 'forum', $smallmessagestrings);
|
||||
//make sure strings are in message recipients language
|
||||
$eventdata->smallmessage = get_string_manager()->get_string('smallmessage', 'forum', $smallmessagestrings, $userto->lang);
|
||||
|
||||
$eventdata->contexturl = "{$CFG->wwwroot}/mod/forum/discuss.php?d={$discussion->id}#p{$post->id}";
|
||||
$eventdata->contexturlname = $discussion->name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user