How do I modify the login block markup? I want to change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.



I am able to modify certain contents of the login block by using this function.

function THEMENAME_form_user_login_block_alter(&amp;$form, &amp;$form_state){
  $item = array();
  if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
    $items[] = l(t('Create new account'), 'user/register', array('attributes' =&gt; array('title' =&gt; t('Create a new user account.'))));
  }
  $items[] = l(t('Request new password'), 'user/password', array('attributes' =&gt; array('title' =&gt; t('If you forgot your password, click to request a new password via e-mail.'))));
  $form['links']['#markup'] = theme('item_list', array('items' =&gt; $items));
}


And this template does pick up the changes and allow for markup changes around the form, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations? 

block--user--login.tpl.php

&lt;div id="user-login-top"&gt;
  &lt;?php print render($title_prefix); ?&gt;
  &lt;?php if ($block-&gt;subject): ?&gt;
    &lt;h2&lt;?php print $title_attributes; ?&gt;&gt;&lt;?php print $block-&gt;subject ?&gt;&lt;/h2&gt;
  &lt;?php endif;?&gt;
 &lt;?php print render($title_suffix); ?&gt;
&lt;/div&gt;
&lt;div id="user-login-block" class="block block-&lt;?php print $block-&gt;module ?&gt;"&gt;
  &lt;div class="content"&lt;?php print $content_attributes; ?&gt;&gt;
    &lt;?php print $content ?&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div id="user-login-bottom" class="block-bottom"&gt;&lt;/div&gt;


This example uses straight markup out of Firebug and it does function, but there should be a cleaner way to do this by printing variables that already contain the markup, and that doesn't remove the "Create new account" option if the site registration is restricted.
you can change the weight of the links like this:

$form['links']['#weight'] = 10000;


now it should be after the submit button :)