Why does not hook_block_view_MODULE_DELTA_alter work? I'm implementing a hook_block_view_MODULE_DELTA_alter for the user login block. 

function mymodule_block_view_user_login_alter(&amp;$data, $block) {
    drupal_set_message($block-&gt;module);
}


According to the block table, the module is user and delta is login.
But, the hook was not invoked and the message was not printed out as expected. I'm using D7.
That hook is called right before a specific block is rendered. If the block isn't present in the page, the hook is not invoked. Replace that hook with hook_block_view_alter(), and it will get invoked for every block shown in the page.

Bear in mind that Drupal caches the hooks implemented from a module; if you alter the code of an enabled module, Drupal will not know the module has a new hook. Disable the module before editing its code, and re-enable it after editing its code; in that way, Drupal will clear its cache, and notice there is a new hook, using it when necessary.