forked from GNUsocial/gnu-social
use a template for confirmation email
This commit is contained in:
parent
332b9400c6
commit
1b5bd8991b
@ -155,7 +155,7 @@ class EmailRegistrationPlugin extends Plugin
|
|||||||
return $nickname;
|
return $nickname;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function sendConfirmEmail($confirm)
|
static function sendConfirmEmail($confirm, $title=null)
|
||||||
{
|
{
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
|
|
||||||
@ -165,25 +165,31 @@ class EmailRegistrationPlugin extends Plugin
|
|||||||
$headers['To'] = trim($confirm->address);
|
$headers['To'] = trim($confirm->address);
|
||||||
// TRANS: Subject for confirmation e-mail.
|
// TRANS: Subject for confirmation e-mail.
|
||||||
// TRANS: %s is the StatusNet sitename.
|
// 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));
|
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
||||||
|
|
||||||
// TRANS: Body for confirmation e-mail.
|
if (empty($title)) {
|
||||||
// TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL.
|
$title = 'confirmemailreg';
|
||||||
$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.'.
|
$confirmTemplate = DocFile::forTitle($title, DocFile::mailPaths());
|
||||||
"\n".
|
|
||||||
'%2$s'.
|
$body = $confirmTemplate->toHTML(array('confirmurl' => $confirmUrl));
|
||||||
"\n".
|
|
||||||
'If it was not you, you can safely ignore this message.'),
|
|
||||||
$sitename,
|
|
||||||
$confirmUrl);
|
|
||||||
|
|
||||||
mail_send($recipients, $headers, $body);
|
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)
|
function onPluginVersion(&$versions)
|
||||||
{
|
{
|
||||||
$versions[] = array('name' => 'EmailRegistration',
|
$versions[] = array('name' => 'EmailRegistration',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user