From: Evan Prodromou Date: Wed, 4 May 2011 18:37:03 +0000 (-0700) Subject: use a template for confirmation email X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1b5bd8991bfb3e0b6891b464e9b1f172ce79f72e;p=quix0rs-gnu-social.git use a template for confirmation email --- diff --git a/plugins/EmailRegistration/EmailRegistrationPlugin.php b/plugins/EmailRegistration/EmailRegistrationPlugin.php index 548702514a..8759614129 100644 --- a/plugins/EmailRegistration/EmailRegistrationPlugin.php +++ b/plugins/EmailRegistration/EmailRegistrationPlugin.php @@ -155,7 +155,7 @@ class EmailRegistrationPlugin extends Plugin return $nickname; } - static function sendConfirmEmail($confirm) + static function sendConfirmEmail($confirm, $title=null) { $sitename = common_config('site', 'name'); @@ -165,25 +165,31 @@ class EmailRegistrationPlugin extends Plugin $headers['To'] = trim($confirm->address); // TRANS: Subject for confirmation e-mail. // TRANS: %s is the StatusNet sitename. - $headers['Subject'] = sprintf(_m('Confirm your registration on %s'), $sitename); + $headers['Subject'] = sprintf(_m('Welcome to %s'), $sitename); + $headers['Content-Type'] = 'text/html; charset=UTF-8'; $confirmUrl = common_local_url('register', array('code' => $confirm->code)); - // TRANS: Body for confirmation e-mail. - // TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL. - $body = sprintf(_m('Someone (probably you) has requested an account on %1$s using this email address.'. - "\n". - 'To confirm the address, click the following URL or copy it into the address bar of your browser.'. - "\n". - '%2$s'. - "\n". - 'If it was not you, you can safely ignore this message.'), - $sitename, - $confirmUrl); + if (empty($title)) { + $title = 'confirmemailreg'; + } + + $confirmTemplate = DocFile::forTitle($title, DocFile::mailPaths()); + + $body = $confirmTemplate->toHTML(array('confirmurl' => $confirmUrl)); mail_send($recipients, $headers, $body); } + function onEndDocFileForTitle($title, $paths, &$filename) + { + if ($title == 'confirmemailreg' && empty($filename)) { + $filename = dirname(__FILE__).'/mail-src/'.$title; + return false; + } + return true; + } + function onPluginVersion(&$versions) { $versions[] = array('name' => 'EmailRegistration',