0

in our 9.3 drupal installation , on the user edit page, the role was before the status. now in 9.5 , the status is above the role. I would like the role to be on top of the status the way it was before and dont see that option in configuration. Can this be done?

1 Answer 1

3

Change order of status & role field of user:

function Mymodulename_form_alter(&$form, &$form_state, $form_id) {
  // user register & user edit form
  if($form_id == 'user_form' || $form_id == 'user_register_form'){
    // Alter the order of role & weight field
    $form['account']['roles']['#weight'] = 1;
    $form['account']['status']['#weight'] = 2; 
  }
}

Note: The roles & status field inside the account array maintained for user entity, these variables can be alter using hook_form_alter()

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.