function user_external_invite_settings_form in User External Invite 1.0.x
Same name and namespace in other branches
- 7.2 user_external_invite.admin.inc \user_external_invite_settings_form()
- 7 user_external_invite.admin.inc \user_external_invite_settings_form()
Configuration form for the module.
1 string reference to 'user_external_invite_settings_form'
- user_external_invite_menu in ./
user_external_invite.module - Implements hook_menu().
File
- ./
user_external_invite.admin.inc, line 11 - Contains forms for the user_external_invite module.
Code
function user_external_invite_settings_form() {
$form = array();
$form['#validate'][] = 'user_external_invite_settings_form_validate';
// Define roles that users can have.
$user_roles = user_roles();
$roles = array();
$excluded_roles = module_invoke_all('user_external_invite_excluded_roles', $roles);
foreach ($excluded_roles as $role_id) {
if (isset($user_roles[$role_id])) {
unset($user_roles[$role_id]);
}
}
$form['user_external_invite_roles'] = array(
'#type' => 'select',
'#title' => t('Roles users can be invited to join'),
'#description' => t('Users with permission to send invites will be able to invite users to join a site with any of these roles. GRANT WITH CAUTION!'),
'#options' => $user_roles,
'#default_value' => variable_get('user_external_invite_roles', NULL),
'#multiple' => TRUE,
);
$form['user_external_invite_default_role'] = array(
'#title' => t('Default Role to Invite'),
'#description' => t('Choose the default role you wish to have selected on the invite page.'),
'#type' => 'radios',
'#options' => $user_roles,
'#default_value' => variable_get('user_external_invite_default_role', key($user_roles)),
);
// Days invite valid for.
$form['user_external_invite_days_valid_for'] = array(
'#type' => 'textfield',
'#title' => t('Number of days invites are valid'),
'#description' => t("Invites are set to expire so many days after they are created. If a user hasn't accepted the invite by that time, then you will have to send a new invite to grant that user a role."),
'#default_value' => variable_get('user_external_invite_days_valid_for', 5),
'#element_validate' => array(
'element_validate_number',
),
'#maxlength' => 3,
);
// Delete old invites after a certain time.
$form['user_external_invite_delete_old_invites'] = array(
'#type' => 'textfield',
'#title' => t('Invite Deletion'),
'#description' => t("Invites are deleted during a cron run after they have passed their expire time. Defaults to 30 days (2592000 seconds)."),
'#default_value' => variable_get('user_external_invite_delete_old_invites', 60 * 60 * 24 * 30),
'#size' => 60,
'#element_validate' => array(
'element_validate_number',
),
'#required' => TRUE,
);
// From email address.
$form['user_external_invite_use_universal_from_email'] = array(
'#type' => 'checkbox',
'#title' => t('Send all invites from a single email address'),
'#description' => t('If this is not configured, invites will be sent using the email address of the user sending the invite.'),
'#default_value' => variable_get('user_external_invite_use_universal_from_email', FALSE),
);
$form['user_external_invite_universal_from_email'] = array(
'#type' => 'textfield',
'#title' => t('Email address invites are sent from'),
'#default_value' => variable_get('user_external_invite_universal_from_email', NULL),
'#maxlength' => 256,
'#states' => array(
'visible' => array(
':input[name="user_external_invite_use_universal_from_email"]' => array(
'checked' => TRUE,
),
),
'required' => array(
':input[name="user_external_invite_use_universal_from_email"]' => array(
'checked' => TRUE,
),
),
),
);
// Inviter email templates.
$form['inviter_template'] = array(
'#type' => 'fieldset',
'#title' => t('Inviter Templates'),
'#description' => t('Templates to notify inviter.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['inviter_template']['user_external_invite_confirmation_template'] = array(
'#title' => t('Invitation Confirmation'),
'#type' => 'textarea',
'#cols' => 40,
'#rows' => 5,
'#default_value' => variable_get('user_external_invite_confirmation_template'),
'#description' => t('Confirmation message sent to inviter confirming the invitation was sent.'),
);
$form['inviter_template']['user_external_invite_accepted_template'] = array(
'#title' => t('Invitation Accepted Email Template'),
'#type' => 'textarea',
'#cols' => 40,
'#rows' => 5,
'#default_value' => variable_get('user_external_invite_accepted_template'),
'#description' => t('Message sent to inviter when the invitee accepts an invite.'),
);
// Invitee email templates.
$form['invitee_template'] = array(
'#type' => 'fieldset',
'#title' => t('Invitee Templates'),
'#description' => t('Templates to notify invitee.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['invitee_template']['user_external_invite_invite_template'] = array(
'#title' => t('Invitation Email Template'),
'#type' => 'textarea',
'#cols' => 40,
'#rows' => 5,
'#default_value' => variable_get('user_external_invite_invite_template'),
'#description' => t('Message sent to user being invited.'),
);
$form['invitee_template']['user_external_invite_accepted_confirmation_template'] = array(
'#title' => t('Invitation Accepted Confirmation Email Template'),
'#type' => 'textarea',
'#cols' => 40,
'#rows' => 5,
'#default_value' => variable_get('user_external_invite_accepted_confirmation_template'),
'#description' => t('Message sent to invitee confirming the process was completed.'),
);
// @TODO: add warning email about expiring invitations.
$form['token_help']['content'] = array(
'#type' => 'markup',
'#token_types' => 'all',
'#theme' => 'token_tree',
);
return system_settings_form($form);
}