4.6.x user.module user_admin_role()
4.7.x user.module user_admin_role()
5.x user.module user_admin_role()
6.x user.admin.inc user_admin_role()
7.x user.admin.inc user_admin_role($form, $form_state, $role)

Form to configure a single role.

See also

user_admin_role_validate()

user_admin_role_submit()

Related topics

6 string references to 'user_admin_role'
standard_install in profiles/standard/standard.install
Implements hook_install().
UserRoleAdminTestCase::testRoleAdministration in modules/user/user.test
Test adding, renaming and deleting roles.
user_admin_settings in modules/user/user.admin.inc
Form builder; Configure user settings for this site.
user_menu in modules/user/user.module
Implements hook_menu().
user_modules_installed in modules/user/user.module
Implements hook_modules_installed().

... See full list

File

modules/user/user.admin.inc, line 951
Admin page callback file for the user module.

Code

function user_admin_role($form, $form_state, $role) {
  if ($role->rid == DRUPAL_ANONYMOUS_RID || $role->rid == DRUPAL_AUTHENTICATED_RID) {
    drupal_goto('admin/people/permissions/roles');
  }

  // Display the edit role form.
  $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' => $role->rid,
  );
  $form['weight'] = array(
    '#type' => 'value',
    '#value' => $role->weight,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save role'),
  );
  $form['actions']['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete role'),
    '#submit' => array(
      'user_admin_role_delete_submit',
    ),
  );
  return $form;
}

Comments

Mac_Weber’s picture

There is also the variable called user_admin_role which stores the role id of the administrator role