Skip to content

Commit

Permalink
MDL-57293 lang/email: Improve emailvia string
Browse files Browse the repository at this point in the history
* Strip the https? part of url for existing strings
* Switch the string to (via shortname)
  • Loading branch information
danpoltawski committed Dec 15, 2016
1 parent 5100c48 commit d0e61e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lang/en/moodle.php
Expand Up @@ -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';
Expand Down
6 changes: 4 additions & 2 deletions lib/moodlelib.php
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit d0e61e8

Please sign in to comment.