function masquerade_admin_settings in Masquerade 6
Same name and namespace in other branches
- 7 masquerade.module \masquerade_admin_settings()
1 string reference to 'masquerade_admin_settings'
- masquerade_menu in ./
masquerade.module - Implementation of hook_menu().
File
- ./
masquerade.module, line 205 - masquerade.module
Code
function masquerade_admin_settings() {
// create a list of roles; all selected roles are considered administrative.
$rids = array();
$result = db_query("SELECT r.rid, r.name FROM {role} r ORDER BY r.name");
while ($obj = db_fetch_object($result)) {
$rids[$obj->rid] = $obj->name;
}
$form['masquerade_admin_roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Roles that are considered "administrators" for masquerading'),
'#options' => $rids,
'#default_value' => variable_get('masquerade_admin_roles', array()),
);
$test_name = _masquerade_user_load(variable_get('masquerade_test_user', ''));
$form['masquerade_test_user'] = array(
'#type' => 'textfield',
'#title' => t('Menu <em>Quick Switch</em> user'),
'#autocomplete_path' => 'masquerade/autocomplete',
'#default_value' => isset($test_name->name) ? check_plain($test_name->name) : '',
'#description' => t('Enter the username of an account you wish to switch easily between via a menu item.'),
'#maxlength' => NULL,
);
$quick_switch_users = array();
foreach (variable_get('masquerade_quick_switches', array()) as $uid) {
$u = user_load(array(
'uid' => $uid,
));
if ($uid == 0) {
$u->name = variable_get('anonymous', t('Anonymous'));
}
$quick_switch_users[] = $u->name;
}
$form['masquerade_quick_switches'] = array(
'#type' => 'textfield',
'#title' => t('Masquerade Block <em>Quick Switch</em> users'),
'#autocomplete_path' => 'masquerade/autocomplete/multiple',
'#default_value' => !empty($quick_switch_users) ? implode(', ', $quick_switch_users) : '',
'#description' => t('Enter the usernames, separated by commas, of accounts to show as quick switch links in the Masquerade block.'),
'#maxlength' => NULL,
);
$form = system_settings_form($form);
$form['#validate'][] = 'masquerade_admin_settings_validate';
$form['#submit'][] = 'masquerade_admin_settings_submit';
return $form;
}