From d0e61e86552d11abc2760a0801d5c83edeed3305 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Tue, 13 Dec 2016 11:01:45 +0000 Subject: [PATCH] MDL-57293 lang/email: Improve emailvia string * Strip the https? part of url for existing strings * Switch the string to (via shortname) --- lang/en/moodle.php | 2 +- lib/moodlelib.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 33db295d06fb9..b7cdece51a44e 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -705,7 +705,7 @@ If you continue to have difficulty, contact the site administrator.'; $string['emailtoprivatefiles'] = 'You can also e-mail files as attachments straight to your private files space. Simply attach your files to an e-mail and send it to {$a}'; $string['emailtoprivatefilesdenied'] = 'Your administrator has disabled the option to upload your own private files.'; -$string['emailvia'] = '{$a->name} via {$a->url}'; +$string['emailvia'] = '{$a->name} (via {$a->siteshortname})'; $string['emptydragdropregion'] = 'empty region'; $string['enable'] = 'Enable'; $string['encryptedcode'] = 'Encrypted code'; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index f6b88c42a045b..f560d0750550a 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -5796,7 +5796,8 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '', $mail->From = $from->email; $fromdetails = new stdClass(); $fromdetails->name = fullname($from); - $fromdetails->url = $CFG->wwwroot; + $fromdetails->url = preg_replace('#^https?://#', '', $CFG->wwwroot); + $fromdetails->siteshortname = format_string($SITE->shortname); $fromstring = $fromdetails->name; if ($CFG->emailfromvia == EMAIL_VIA_ALWAYS) { $fromstring = get_string('emailvia', 'core', $fromdetails); @@ -5809,7 +5810,8 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '', $mail->From = $noreplyaddress; $fromdetails = new stdClass(); $fromdetails->name = fullname($from); - $fromdetails->url = $CFG->wwwroot; + $fromdetails->url = preg_replace('#^https?://#', '', $CFG->wwwroot); + $fromdetails->siteshortname = format_string($SITE->shortname); $fromstring = $fromdetails->name; if ($CFG->emailfromvia != EMAIL_VIA_NEVER) { $fromstring = get_string('emailvia', 'core', $fromdetails);