Jon Saints wrote:
If you're doing this in with custom code, you should give http://drupal.org/project/sections a try. The module has been thoroughly tested and works AFAIK. Similar, but different purpose is http://drupal.org/project/switchtheme.
Thanks. I will check out these modules
You should not try to change the theme on block administration pages. Above mentioned modules implement exactly this exception.
As for the bug in the block module, I think there is actually a good reason that the author of the block module in core is trying (but not succeeding) to change the theme on block administration pages. As you to edit blocks for different themes in the block admin it helps to have the active theme change accordingly so that a user can see where on the page the block regions will be appearing. Different themes can have different arrangements of regions.
The bug occurs when the block_admin_display() function changes $custom_theme variable and calls init_theme(). The global variable $theme has already been set by a previous init_theme() call somehwere in drupal so init_theme() is essentially ignored in block_admin_display(). The theme does not change. That is why we are seeing the wrong list of blocks appear for any theme that is not the active theme.
So... how best to deal with this?
IMO this is not a bug in block module; it's a bug in whatever is calling theme() or init_theme() before block module has a chance to set custom_theme.