Option for custom template for confirmation email

This commit is contained in:
Evan Prodromou 2011-05-04 11:37:32 -07:00
parent 1b5bd8991b
commit aef62ccbcc
2 changed files with 22 additions and 8 deletions

View File

@ -22,15 +22,16 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'w';
$longoptions = array('welcome');
$shortoptions = 'wt::';
$longoptions = array('welcome', 'template=');
$helptext = <<<END_OF_INSTALLFOREMAIL_HELP
installforemail.php [options] <email address>
Create a new account and, if necessary, a new network for the given email address
-w --welcome Send a welcome email
-w --welcome Send a welcome email
-t --template= Use this email template
END_OF_INSTALLFOREMAIL_HELP;
@ -62,7 +63,13 @@ StatusNet::switchSite($sn->nickname);
$confirm = EmailRegistrationPlugin::registerEmail($email);
if (have_option('w', 'welcome')) {
EmailRegistrationPlugin::sendConfirmEmail($confirm);
if (have_option('t', 'template')) {
// use the provided template
EmailRegistrationPlugin::sendConfirmEmail($confirm, get_option_value('t', 'template'));
} else {
// use the default template
EmailRegistrationPlugin::sendConfirmEmail($confirm);
}
}
$confirmUrl = common_local_url('register', array('code' => $confirm->code));

View File

@ -20,14 +20,15 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'w';
$longoptions = array('welcome');
$shortoptions = 'wt::';
$longoptions = array('welcome', 'template=');
$helptext = <<<END_OF_REGISTEREMAILUSER_HELP
registeremailuser.php [options] <email address>
Options:
-w --welcome Send a welcome email
-w --welcome Send a welcome email
-t --template= Use this email template
register a new user by email address.
@ -44,7 +45,13 @@ $email = $args[0];
$confirm = EmailRegistrationPlugin::registerEmail($email);
if (have_option('w', 'welcome')) {
EmailRegistrationPlugin::sendConfirmEmail($confirm);
if (have_option('t', 'template')) {
// use the provided template
EmailRegistrationPlugin::sendConfirmEmail($confirm, get_option_value('t', 'template'));
} else {
// use the default template
EmailRegistrationPlugin::sendConfirmEmail($confirm);
}
}
$confirmUrl = common_local_url('register', array('code' => $confirm->code));