When you have a default theme set that is different from the admin theme it does not rehash the appropriate theme. To replicate this set up a default standard Drupal installation install nodeblock 7.x-1.2 and set it up to a content type. Create a node of that content type and watch the block table in the database. The theme column of that record will match the admin theme.

Here is a fix attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David Stosik’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Priority: Major » Normal
Status: Active » Needs review
FileSize
1.02 KB

Actually, the code is not that wrong, as inserted block is coherent, and no big bug is provoked, as going to admin/structure/block will call _block_rehash() for your current theme.

But, I would say that current code is kind of incomplete: either no _block_rehash() should be called at all during node save, or, it should be called on all active themes (if we want to update blocks list, let's do it fully, or not at all).
As there are some modules out there that don't call _block_rehash() because it is time consuming, and just assume that block table is always up-to-date (which is not the case with current code), I suggest calling _block_rehash() on all active themes.
Please find my patch attached.

David Stosik’s picture

And here is a better patch replacing another _block_rehash() call in delete hook.

Johnny vd Laar’s picture

Status: Needs review » Fixed

I've added this patch but I'm still thinking about removing the block_rehash completely from the module as I don't think this needs to be done by nodeblocks.

http://drupalcode.org/project/nodeblock.git/commit/a22093f

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Johnny vd Laar’s picture