From a7515136489a13212b0809268d5aefa0cfe37971 Mon Sep 17 00:00:00 2001 From: Hiroto Kagotani Date: Sun, 4 Jul 2021 20:35:32 +0900 Subject: [PATCH] Use the system-wide setting for fullname display --- classes/local_contact.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/local_contact.php b/classes/local_contact.php index 0e85391..d293fb2 100644 --- a/classes/local_contact.php +++ b/classes/local_contact.php @@ -44,7 +44,7 @@ public function __construct() { if (isloggedin() && !isguestuser()) { // If logged-in as non guest, use their registered fullname and email address. global $USER; - $this->fromname = $USER->firstname . ' ' . $USER->lastname; + $this->fromname = get_string('fullnamedisplay', null, $USER); $this->fromemail = $USER->email; // Insert name and email address at first position in $_POST array. if (!empty($_POST['email'])) { @@ -373,7 +373,7 @@ public function sendmessage($email, $name, $sendconfirmationemail = false) { private function moodleuserstatus($emailaddress) { if (isloggedin() && !isguestuser()) { global $USER; - $info = $USER->firstname . ' ' . $USER->lastname . ' / ' . $USER->email . ' (' . $USER->username . + $info = get_string('fullnamedisplay', null, $USER) . ' / ' . $USER->email . ' (' . $USER->username . ' / ' . get_string('eventuserloggedin', 'auth') . ')'; } else { global $DB; @@ -396,7 +396,7 @@ private function moodleuserstatus($emailaddress) { $extrainfo .= ' / ' . get_string('notconfirmed', 'local_contact'); } - $info = $user->firstname . ' ' . $user->lastname . ' / ' . $user->email . ' (' . $user->username . + $info = get_string('fullnamedisplay', null, $user) . ' / ' . $user->email . ' (' . $user->username . ' / ' . get_string('eventuserloggedout') . $extrainfo . ')'; break; default: // We found multiple users with this email address.