In a hook_user of my module I wrote
$form['picture'] = array('#weight' => 10);
to bring the picture fieldset to the bottom of the form. But it's to much to the bottom, it is UNDER the Save button. This also happens to other fieldsets if I try to overwrite their weight.

Already tried out to find the reason, but only could find the function weight_value() in form.inc, which isn't called from anywhere.

Comments

blakehall’s picture

Status: Active » Closed (works as designed)

The 'form' op of hook_user is for _injecting_ form elements into the form rather than modifying them. Trying to use hook_user to do this, alters the form array to look like:

$form['picture']['#weight'] = array( 0 => 10, 1 => 1);

Your module could use hook_form_alter to reset the weight of the picture element like:

  
  function userfix_form_alter(&$form, $form_state, $form_id) {
    $form['picture']['#weight'] = 11;
  }

(The weight on the submit button is 30, by default).

Hope this helps.