From aef62ccbcc5930692b86c2136fe15df6b9b0cbea Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 11:37:32 -0700 Subject: [PATCH] Option for custom template for confirmation email --- .../scripts/installforemail.php | 15 +++++++++++---- .../scripts/registeremailuser.php | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/plugins/DomainStatusNetwork/scripts/installforemail.php b/plugins/DomainStatusNetwork/scripts/installforemail.php index 037e0cad1f..98ce620c28 100644 --- a/plugins/DomainStatusNetwork/scripts/installforemail.php +++ b/plugins/DomainStatusNetwork/scripts/installforemail.php @@ -22,15 +22,16 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); -$shortoptions = 'w'; -$longoptions = array('welcome'); +$shortoptions = 'wt::'; +$longoptions = array('welcome', 'template='); $helptext = << 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)); diff --git a/plugins/EmailRegistration/scripts/registeremailuser.php b/plugins/EmailRegistration/scripts/registeremailuser.php index a9eff9a848..02915240d3 100644 --- a/plugins/EmailRegistration/scripts/registeremailuser.php +++ b/plugins/EmailRegistration/scripts/registeremailuser.php @@ -20,14 +20,15 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); -$shortoptions = 'w'; -$longoptions = array('welcome'); +$shortoptions = 'wt::'; +$longoptions = array('welcome', 'template='); $helptext = << 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));