When switching to a new theme that has never been activated before, information about the blocks that should appear are copied to the new theme configuration but at the same time, the title values of all the blocks are not copied.
What you wind up with is the same block configuration as your old theme, only the blocks have no titles. Is this the intended behavior, or is this a bug? To me it seems like a bug, as I don't know if it makes sense to have titles 'disappear' when you change themes. I've attached a patch which fixes the behavior
Comments
Comment #1
Mapache commentedThe linked patch is not quite correct. It inserts the title as an integer instead of as a string, so all the titles get set to zero (because php tries to read the titles as numbers and fails to parse anything useful out of them).
To fix this, change the last %d to '%s' (with quotes). Thus, the amended patch would be:
Comment #2
ksenzeeHoly cow. I just ran into this in D7.
Comment #3
ksenzeeUpdated version of the original patch attached. The premise is sound, and the patch still works.
Comment #4
ksenzeeSetting back to block.module.
Comment #5
David_Rothstein commentedCan drupal_write_record() be used here instead?
It seems like that might avoid these kinds of bugs in the future.
Comment #6
ksenzeeWhy yes, we can.
Comment #8
David_Rothstein commentedKatherine and I actually beat the testbot to figuring out this was wrong, but good that the testbot saw it too :)
We need to be writing new database records, rather than overwriting existing ones.
So something like this perhaps:
Or alternatively going back to the original approach would be fine too, but in the long run I feel like a drupal_write_record() solution might be a little cleaner.
Comment #9
ksenzeeI don't really see the need for drupal_write_record() now that we have the new DB layer, to be honest, but it makes no real difference to me. As long as it works. :) Here's a patch with unset($block['bid']) as suggested.
Comment #10
David_Rothstein commentedLooks good to me, and I verified that it works.
I think drupal_write_record() is good because it prevents having to keep track of the entire list of database columns in the code, which is kind of fragile :)
Comment #11
dries commentedCommitted to CVS HEAD. Thanks.