Merge pull request #2931 from tobiasd/20161118-issue2926

send email confirming pending registration #2916
This commit is contained in:
Michael Vogel 2016-11-19 15:21:06 +01:00 committed by GitHub
commit ea38af9799
2 changed files with 29 additions and 0 deletions

View file

@ -378,6 +378,29 @@ function create_user($arr) {
} }
/**
* @brief send registration confiŕmation with the intormation that reg is pending
*
* @param string $email
* @param string $sitename
* @param string $username
* @return NULL|boolean from notification() and email() inherited
*/
function send_register_pending_eml($email, $sitename, $username) {
$body = deindent(t('
Dear %1$s,
Thank you for registering at %2$s. Your account is pending for approval by the administrator.
'));
$body = sprintf($body, $username, $sitename);
return notification(array(
'type' => "SYSTEM_EMAIL",
'to_email' => $email,
'subject'=> sprintf( t('Registration at %s'), $sitename),
'body' => $body));
}
/* /*
* send registration confirmation. * send registration confirmation.
* It's here as a function because the mail is sent * It's here as a function because the mail is sent

View file

@ -133,6 +133,7 @@ function register_post(&$a) {
$admin_mail_list $admin_mail_list
); );
// send notification to admins
foreach ($adminlist as $admin) { foreach ($adminlist as $admin) {
notification(array( notification(array(
'type' => NOTIFY_SYSTEM, 'type' => NOTIFY_SYSTEM,
@ -149,6 +150,11 @@ function register_post(&$a) {
'show_in_notification_page' => false 'show_in_notification_page' => false
)); ));
} }
// send notification to the user, that the registration is pending
send_register_pending_eml(
$user['email'],
$a->config['sitename'],
$user['username']);
info( t('Your registration is pending approval by the site owner.') . EOL ) ; info( t('Your registration is pending approval by the site owner.') . EOL ) ;
goaway(z_root()); goaway(z_root());