function userprotect_protection_defaults in User protect 6
Same name and namespace in other branches
- 5 userprotect.module \userprotect_protection_defaults()
- 7 userprotect.admin.inc \userprotect_protection_defaults()
Builds a form for the userprotect default settings.
Return value
An array representing the form.
4 string references to 'userprotect_protection_defaults'
- userprotect_add_user in ./
userprotect.module - Adds a user to the protections table.
- userprotect_menu in ./
userprotect.module - Implementation of hook_menu().
- userprotect_uninstall in ./
userprotect.install - Implementation of hook_uninstall().
- userprotect_user in ./
userprotect.module - Implementation of hook_user().
File
- ./
userprotect.module, line 812
Code
function userprotect_protection_defaults() {
// Get the list of all protections, and the current default settings.
$options = userprotect_get_protection_display();
$current_defaults = variable_get('userprotect_protection_defaults', userprotect_user_protection_defaults());
// Transform the defaults into proper checkboxes defaults.
$defaults = array_keys(array_filter($current_defaults));
// A set of checkboxes that lists the default protection settings.
$form['userprotect_protection_defaults'] = array(
'#type' => 'checkboxes',
'#title' => t('User protection defaults'),
'#description' => t('The selected protections will be assigned to users when they are first added for protection.'),
'#options' => $options,
'#default_value' => $defaults,
);
// A checkbox to enable the auto-protect functionality.
$form['userprotect_autoprotect'] = array(
'#type' => 'checkbox',
'#title' => t('Auto-protect new users'),
'#description' => t('If selected, all newly created users will automatically be protected and assigned the default protections above.'),
'#default_value' => variable_get('userprotect_autoprotect', FALSE),
);
// A set of checkboxes that lists the default protection settings.
$form['userprotect_administrator_bypass_defaults'] = array(
'#type' => 'checkboxes',
'#title' => t('Administrator bypass defaults'),
'#description' => t('If selected, all users with the \'administer users\' permission will be allowed to bypass the protection<br \\><em>Note: this default setting is overridden by the !per_user_bypass.</em>.', array(
'!per_user_bypass' => l(t('per-user administrator bypass settings'), 'admin/user/userprotect/administrator_bypass'),
)),
'#options' => $options,
'#default_value' => variable_get('userprotect_administrator_bypass_defaults', userprotect_administrator_bypass_defaults()),
);
return system_settings_form($form);
}