Change order (weight) of blocks before page load programatically
You can use hook_block_list_alter to achieve this. Be aware that the $block-&gt;weight attribute won't be affected at this point in the proceedings, but there are solutions in the comments to this problem.