How to re-order user profile form? I have this code:

function mymod_form_user_profile_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['account']['#weight'] = 100;
}


Which is supposed to push the 'account' section of stuff underneath the rest of the form elements. But the weight seems to be fixed/the order is unchanged?

I've inspected the $form array at the point my code runs, and there are all the other fields, with their respective #weight values; and 100 is larger than any of those.
The weight you set here would be overridden by the weight values you set via Mange Fields.

However...

You can get around this by changing the weight in pre_render.

E.g. 

function mymod_form_user_profile_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['#pre_render'][] = 'mymod_form_alter_weight';
}

function mymod_form_alter_weight($elements) {
  $elements['account']['#weight'] = 100;

  return $elements;
}