| 1 |
<?php
|
| 2 |
// $Id: user_register_notify.admin.inc,v 1.6 2009/01/20 22:22:45 rmiddle Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Settings form.
|
| 7 |
*/
|
| 8 |
|
| 9 |
define('USER_REGISTER_NOTIFY_SUBJECT', t('Account details for !user_name at !site'));
|
| 10 |
define('USER_REGISTER_NOTIFY_BODY', t("!user_name (!user_view) has !action account.\n\nEdit user: !user_edit\n\nDelete User: !user_delete\n\n!profile"));
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Module settings page.
|
| 14 |
*/
|
| 15 |
function user_register_notify_settings() {
|
| 16 |
$form['user_notify'] = array(
|
| 17 |
'#type' => 'fieldset',
|
| 18 |
'#title' => t('User Alerts'),
|
| 19 |
'#collapsible' => TRUE,
|
| 20 |
'#collapsed' => FALSE
|
| 21 |
);
|
| 22 |
$user_notify_opts = array(
|
| 23 |
'Custom' => t('Send to a custom email address'),
|
| 24 |
'Role' => t('Send to a specific role(s)'),
|
| 25 |
'Both' => t('Send to Both a custom email address and a specific role(s)'),
|
| 26 |
);
|
| 27 |
$form['user_notify']['user_register_notify_type'] = array(
|
| 28 |
'#type' => 'radios',
|
| 29 |
'#options' => $user_notify_opts,
|
| 30 |
'#title' => t('Send by Role or Custom Email address?'),
|
| 31 |
'#default_value' => variable_get('user_register_notify_type', 'Custom'),
|
| 32 |
'#prefix' => '<div class="user-register-notify-user-notify">',
|
| 33 |
'#suffix' => '</div>',
|
| 34 |
);
|
| 35 |
$form['user_notify']['user_register_notify_mailto'] = array(
|
| 36 |
'#type' => 'textfield',
|
| 37 |
'#title' => t('Send notifications to this custom email address'),
|
| 38 |
'#description' => t('If you leave this blank, the site email address, %mailto, will be used.', array('%mailto' => variable_get('site_mail', ini_get('sendmail_from')))),
|
| 39 |
'#default_value' => variable_get('user_register_notify_mailto', variable_get('site_mail', ini_get('sendmail_from'))),
|
| 40 |
);
|
| 41 |
$user_roles = user_roles(TRUE);
|
| 42 |
$form['user_notify']['user_register_notify_roles'] = array(
|
| 43 |
'#type' => 'checkboxes',
|
| 44 |
'#title' => t('Send to a specific role(s)'),
|
| 45 |
'#options' => $user_roles,
|
| 46 |
'#description' => t('All users with these checked roles will receive a notification email when selected.'),
|
| 47 |
'#default_value' => variable_get('user_register_notify_roles', user_roles(TRUE)),
|
| 48 |
);
|
| 49 |
|
| 50 |
$form['user_register_notify_subject'] = array(
|
| 51 |
'#type' => 'textfield',
|
| 52 |
'#title' => t('Email Subject'),
|
| 53 |
'#default_value' => variable_get('user_register_notify_subject', USER_REGISTER_NOTIFY_SUBJECT),
|
| 54 |
'#required' => TRUE,
|
| 55 |
'#description' => t('Subject of user registration messages')
|
| 56 |
);
|
| 57 |
$form['user_register_notify_body'] = array(
|
| 58 |
'#type' => 'textarea',
|
| 59 |
'#title' => t('Email Body'),
|
| 60 |
'#default_value' => variable_get('user_register_notify_body', USER_REGISTER_NOTIFY_BODY),
|
| 61 |
'#rows' => 10,
|
| 62 |
'#required' => TRUE,
|
| 63 |
'#description' => t('Customize the body of the user registration notification email.') .' '. t('Available variables are:') .' !user_name, !user_mail, !user_view, !user_edit, !user_delete, !site, !uri, !uri_brief, !date, !action, !profile, !og.'
|
| 64 |
);
|
| 65 |
$alert_options = array(
|
| 66 |
'create' => 'Receive Email upon user creation.',
|
| 67 |
'update' => 'Receive Email upon user creation and update.',
|
| 68 |
);
|
| 69 |
$form['user_register_notify_alert'] = array(
|
| 70 |
'#type' => 'radios',
|
| 71 |
'#options' => $alert_options,
|
| 72 |
'#title' => t('Page Sort order'),
|
| 73 |
'#default_value' => variable_get('user_register_notify_alert', 'create'),
|
| 74 |
'#description' => t('When to send an Email'),
|
| 75 |
'#required' => FALSE,
|
| 76 |
);
|
| 77 |
return system_settings_form($form);
|
| 78 |
}
|