Code for module weight does not work I have two modules about login forms. Want to give weight to them , but my code does not work. I put this in template.php, maybe I missed something. I restart mysql, but it does not help. 

$weight = db_select('system', 's')
      -&gt;fields('s', array('weight'))
      -&gt;condition('name', '[commerce_checkout_redirect]', '=')
      -&gt;execute()
      -&gt;fetchField();

  // Set our module to a weight 1 heavier, so ours moves lower in execution order
 db_update('system')
    -&gt;fields(array('weight' =&gt; $weight + 1))
    -&gt;condition('name', '[redirect_after_login]', '=')
    -&gt;execute();
Eliminate the square brackets from the query and it should work:

$weight = db_select('system', 's')
  -&gt;fields('s', array('weight'))
  -&gt;condition('name', 'commerce_checkout_redirect', '=')
  -&gt;execute()
  -&gt;fetchField();


// Set our module to a weight 1 heavier, so ours moves lower in execution order

 db_update('system')
    -&gt;fields(array('weight' =&gt; $weight + 1))
    -&gt;condition('name', 'redirect_after_login', '=')
    -&gt;execute();