function saferpermissions_form_user_admin_permissions_alter in Safer Permissions 7
Implements hook_form_FORM_ID_alter().
File
- ./
saferpermissions.module, line 11 - Disallows unwanted permissions for anonymous.
Code
function saferpermissions_form_user_admin_permissions_alter(&$form, &$form_state) {
if (isset($form['checkboxes'][DRUPAL_ANONYMOUS_RID])) {
if (empty($form['checkboxes'][DRUPAL_ANONYMOUS_RID]['#process'])) {
$checkboxes_element_info = element_info('checkboxes');
$form['checkboxes'][DRUPAL_ANONYMOUS_RID]['#process'] = $checkboxes_element_info['#process'];
}
// Attach a process function which disables the checkboxes.
$form['checkboxes'][DRUPAL_ANONYMOUS_RID]['#process'][] = '_saferpermissions_anonymous_permissions_process';
// Attach a validator which makes sure that the checkbox is not checked
// even if the user checks the checkbox by removing the disabled attribute
// manually.
$form['checkboxes'][DRUPAL_ANONYMOUS_RID]['#element_validate'][] = '_saferpermissions_anonymous_permissions_element_validate';
}
}