function user_admin_role in Drupal 4
Same name and namespace in other branches
- 5 modules/user/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.
1 string reference to 'user_admin_role'
- user_menu in modules/
user.module - Implementation of hook_menu().
File
- modules/
user.module, line 1873 - Enables the user registration and login system.
Code
function user_admin_role() {
$id = arg(4);
if ($id) {
// Display role edit 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'),
);
return drupal_get_form('user_admin_edit_role', $form);
}
else {
$form['name'] = array(
'#type' => 'textfield',
'#size' => 32,
'#maxlength' => 64,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add role'),
);
return drupal_get_form('user_admin_new_role', $form);
}
}