As seen on http://api.drupal.org/api/drupal/modules%21block%21block.api.php/functio... and verified with local testing:

Can't remove blocks with hook_block_info_alter
Posted by Josh Waihi on February 22, 2012 at 10:53pm
Don't use this hook to unset blocks from other modules. Unlike other alter hooks, removing an index from this array won't help at all.

Instead, it will prevent you from saving blocks to regions and it will clear your database table out for your configured theme.

Potentially this is a core bug, but I guess they never expected blocks to be removed.

We actually need this for Drupal.org and Aggregator blocks.

Comments

webchick’s picture

Cross-linking #1550044: Remove aggregator blocks from admin/structure/block

And major because it's an edge case, but there's a data loss component to it. Literally, all of your block associations disappear.

webchick’s picture

Issue tags: +Needs backport to D7

Tagging once more.

webchick’s picture

Tagging once more.

catch’s picture

webchick’s picture

Category: bug » support
Priority: Major » Normal

CATCH! YOU ARE MY FAVOURITE PERSON EVER!

I'm going to go try this.

webchick’s picture

Category: support » bug
Priority: Normal » Major

Oops. Nope. We need to do something else. The list of modules at admin/structure/block, which right now looks like this:

(

webchick’s picture

Oh but you're still up there on my favourite people nonetheless. ;)

drumm’s picture

Issue tags: -drupal.org D7, -porting

Solved a different way for Drupal.org.

webchick’s picture

Priority: Major » Normal
catch’s picture

There's also hook_module_implements_alter(), would be good to know what the Drupal.org workaround was.

webchick’s picture

Oh, sorry. The workaround was in #1550044: Remove aggregator blocks from admin/structure/block.

In D7 we added a threshold setting to Aggregator module for the # of entries to include in a block, and when that number is set to 0, the block doesn't appear. Kind of stupid, but it works. :)

GuyPaddock’s picture

Priority: Normal » Major

Still major, still data loss...

chx’s picture

Priority: Major » Normal

I quite disagree with this being major. It was only bumped cos d.o. needed it but that could be solved otherwise.

benjy’s picture

Version: 8.x-dev » 7.x-dev

hook_block_info_alter() has been removed from D8 so putting back to 7.x

ParisLiakos’s picture

Priority: Normal » Major

it *is* major, not to say critical..remove block keys from the array and *boom* Good luck rebuilding your blocks...and if your site heavily depends on them. well you are screwed. because you cant really remember the exact weight and visibility settings for every single one of them.

ParisLiakos’s picture

Title: Can't remove blocks from hook_block_info_alter() » Removing blocks from hook_block_info_alter() leads to data loss
ParisLiakos’s picture

Issue summary: View changes

Updated issue summary.