MDL-65819 message: send contact requests using recipient language.
authorPaul Holden <paulh@moodle.com>
Wed, 15 Jul 2020 18:45:49 +0000 (19:45 +0100)
committerPaul Holden <paulh@moodle.com>
Wed, 15 Jul 2020 19:24:44 +0000 (20:24 +0100)
message/classes/api.php

index 0055855..86708bc 100644 (file)
@@ -2629,14 +2629,15 @@ class api {
         $userto = \core_user::get_user($requesteduserid);
         $url = new \moodle_url('/message/index.php', ['view' => 'contactrequests']);
 
-        $subject = get_string('messagecontactrequestsubject', 'core_message', (object) [
+        $subject = get_string_manager()->get_string('messagecontactrequestsubject', 'core_message', (object) [
             'sitename' => format_string($SITE->fullname, true, ['context' => \context_system::instance()]),
             'user' => $userfromfullname,
-        ]);
-        $fullmessage = get_string('messagecontactrequest', 'core_message', (object) [
+        ], $userto->lang);
+
+        $fullmessage = get_string_manager()->get_string('messagecontactrequest', 'core_message', (object) [
             'url' => $url->out(),
             'user' => $userfromfullname,
-        ]);
+        ], $userto->lang);
 
         $message = new \core\message\message();
         $message->courseid = SITEID;