#119038 by ximo, Pancho: user role editing usability: include disabled checkbox for authenticated role

6.x
Gábor Hojtsy 2008-01-22 07:51:56 +00:00
parent f5a85afc2e
commit ba5468e508
1 changed files with 26 additions and 2 deletions

View File

@ -1422,14 +1422,38 @@ function user_edit_form(&$form_state, $uid, $edit, $register = FALSE) {
);
}
if ($admin) {
$form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => isset($edit['status']) ? $edit['status'] : 1, '#options' => array(t('Blocked'), t('Active')));
$form['account']['status'] = array(
'#type' => 'radios',
'#title' => t('Status'),
'#default_value' => isset($edit['status']) ? $edit['status'] : 1,
'#options' => array(t('Blocked'), t('Active'))
);
}
if (user_access('administer permissions')) {
$roles = user_roles(TRUE);
// The disabled checkbox subelement for the 'authenticated user' role
// must be generated separately and added to the checkboxes element,
// because of a limitation in D6 FormAPI not supporting a single disabled
// checkbox within a set of checkboxes.
// TODO: This should be solved more elegantly. See issue #119038.
$checkbox_authenticated = array(
'#type' => 'checkbox',
'#title' => $roles[DRUPAL_AUTHENTICATED_RID],
'#default_value' => TRUE,
'#disabled' => TRUE,
);
unset($roles[DRUPAL_AUTHENTICATED_RID]);
if ($roles) {
$default = empty($edit['roles']) ? array() : array_keys($edit['roles']);
$form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => $default, '#options' => $roles, '#description' => t('The user receives the combined permissions of the %au role, and all roles selected here.', array('%au' => t('authenticated user'))));
$form['account']['roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Roles'),
'#default_value' => $default,
'#options' => $roles,
DRUPAL_AUTHENTICATED_RID => $checkbox_authenticated,
);
}
}