I am using Auto Assign Role Module to allow users to choose their role during registration. Block to choose role appears as first block, before the default fields (username, email and password).

Is there a way to move AAR block to the bottom, after the default fields?

1 Answer 1


Yes. You can reorder any Drupal form elements by altering its #weight property. To make the auto assign element appear above the other account registration elements just adjust its weight lighter.

This can be done in hook_form_user_register_form_alter() invocation:

 * Implements hook_form_ID_alter().
function MYMODULE_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  // Set the autoassignrole_user element 1 unit lighter than account form element
  $form['autoassignrole_user']['#weight'] = $form['account']['#weight'] - 1;

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.