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.