1

How to allow a role to edit/manage user accounts e.g. click Edit and change email, username, password etc., but do not edit the fields itself, e.g. cannot just go to Manage fields and delete/create/edit fields?

Field permission doesn't do that, it's specifically just for each field per field.

Do not have access to admin/config/people/accounts/fields at all. enter image description here

But they still can go to admin/people and update/manage users. So they still must have the Administer users permission enter image description here

2 Answers 2

1

On Drupal 7, the permission to access admin/config/people/accounts is the same permission that allows to edit every account created on the site. The permission is returned by user_entity_info(), a hook_entity_info() implementation. Any module that implements hook_entity_info_alter(), including a custom module, can alter what the User module returns in its hook implementation.

/**
 * Implements hook_entity_info_alter().
 */
function mymodule_entity_info_alter(&$entity_info) {
  $entity_info['user']['bundles']['user']['admin']['access arguments'] = 'a new permission defined from the module';
}

The module must then implement hook_permission() to define a new permission, keeping in mind that what I indicated with 'a new permission defined from the module' is the new permission required to access admin/config/people/accounts.

1
  • Didn't use it, but I guess it wouldn't be fair accepting my own answer. Maybe this will help to others. Nov 15, 2023 at 12:36
0

Solved with Rules.

  1. Action: Drupal is initializing
  2. Condition: Text Comparison or Data Comparison, put in the URL path
  3. Action: Page redirect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.