function user_admin_role in Drupal 5
Same name and namespace in other branches
- 4 modules/user.module \user_admin_role()
- 6 modules/user/user.admin.inc \user_admin_role()
- 7 modules/user/user.admin.inc \user_admin_role()
Menu callback: administer roles.
2 string references to 'user_admin_role'
- user_forms in modules/
user/ user.module - user_menu in modules/
user/ user.module - Implementation of hook_menu().
File
- modules/
user/ user.module, line 1932 - Enables the user registration and login system.
Code
function user_admin_role() {
$id = arg(4);
if ($id) {
if (DRUPAL_ANONYMOUS_RID == $id || DRUPAL_AUTHENTICATED_RID == $id) {
drupal_goto('admin/user/roles');
}
// Display the edit role form.
$role = db_fetch_object(db_query('SELECT * FROM {role} WHERE rid = %d', $id));
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Role name'),
'#default_value' => $role->name,
'#size' => 30,
'#required' => TRUE,
'#maxlength' => 64,
'#description' => t('The name for this role. Example: "moderator", "editorial board", "site architect".'),
);
$form['rid'] = array(
'#type' => 'value',
'#value' => $id,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save role'),
);
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete role'),
);
}
else {
$form['name'] = array(
'#type' => 'textfield',
'#size' => 32,
'#maxlength' => 64,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add role'),
);
$form['#base'] = 'user_admin_role';
}
return $form;
}