Duplicating block settings across themes in Drupal
I am currently working on an evolution of a website powered by Drupal (version 5). This evolution requires to install a new theme which will then be enabled for specific pages. Activating a new theme triggers the creation of a new set of configuration options for the blocks. In Drupal, blocks are boxes of content that may be rendered into certain regions of web pages, for example, into sidebars. Blocks can be positioned by specifying which area of the page they should appear in (e.g., a sidebar).
Unfortunately, the settings for the blocks for the new theme are reset to the default values. It is a bit problematic because these settings are usually identical across similar themes. For example, my project has already 85 activated blocks including 27 visible blocks. The visibility of these blocks are often controlled by PHP code.
A bit of SQL can however resolve the issue by copying the block settings from one theme to another. In the following code, the current theme is
old-theme and the newly activated theme is