function simple_ldap_active_group_form_alter in Simple LDAP 7.2
Same name and namespace in other branches
- 7 contrib/simple_ldap_active_group/simple_ldap_active_group.module \simple_ldap_active_group_form_alter()
Implements hook_form_alter().
File
- contrib/
simple_ldap_active_group/ simple_ldap_active_group.module, line 10 - Main simple_ldap_active_group module file.
Code
function simple_ldap_active_group_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
// Add a "Default LDAP group" option to the simple_ldap_role admin form.
case 'simple_ldap_role_admin':
$form['role']['simple_ldap_active_group_group'] = array(
'#type' => 'textfield',
'#title' => t('Default LDAP group'),
'#default_value' => variable_get('simple_ldap_active_group_group'),
'#required' => TRUE,
'#description' => t('This is the group that a user is added to or removed from when the account status is set to active or blocked, respectively.'),
);
break;
// Add an option to disregard the search filter when deleting an user on the
// simple_ldap_user admin form.
case 'simple_ldap_user_admin':
$advanced = array();
foreach ($form['advanced'] as $key => $value) {
$advanced[$key] = $value;
if ($key == 'simple_ldap_user_filter') {
$advanced['simple_ldap_active_group_delete_filtered'] = array(
'#type' => 'checkbox',
'#title' => t('Delete LDAP entries, even if they do not match the filter'),
'#default_value' => variable_get('simple_ldap_active_group_delete_filtered', FALSE),
'#description' => t("If this is enabled, a user will be deleted from LDAP when deleted from Drupal, even if the user's DN does not match the specified search filter."),
);
}
}
$form['advanced'] = $advanced;
break;
}
}