function userprotect_protection_defaults in User protect 7
Same name and namespace in other branches
- 5 userprotect.module \userprotect_protection_defaults()
- 6 userprotect.module \userprotect_protection_defaults()
Builds a form for the userprotect default settings.
Return value
array 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 - Implements hook_menu().
- userprotect_uninstall in ./
userprotect.install - Implements hook_uninstall().
- userprotect_user_insert in ./
userprotect.module - Implements hook_user_insert().
File
- ./
userprotect.admin.inc, line 371 - Administration functions for userprotect module.
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 <a href="!per_user_bypass">per-user administrator bypass settings</a>.</em>.', array(
'!per_user_bypass' => url('admin/config/people/userprotect/administrator_bypass'),
)),
'#options' => $options,
'#default_value' => variable_get('userprotect_administrator_bypass_defaults', userprotect_administrator_bypass_defaults()),
);
return system_settings_form($form);
}