There are some ways to insert into blocks table many records with the same module and delta values but with different theme value. In code there are some sql queries which use only module and delta to select single record.

When there is more than one record with the same module and delta values, and you open configuration form for that block, data in form will be loaded randomly from any of those records.

I found that function block_admin_configure causes problems. SQL query in that function use only module and delta columns to select single record.

It is hardly/not understandable why a column has been called delta instead of some_id, and what columns belong to primary key in blocks table. I suppose that this is a reason of mistakes in sql queries. It is then supposed that there are more mistakes of that kind in blocks module.

I have attached simple patch that enables any configuration of blocks with the same module and delta values but different theme value.

--- block.module        (revision 1024)
+++ block.module        (working copy)
@@ -366,11 +366,14 @@
  * Menu callback; displays the block configuration form.
  */
 function block_admin_configure($module = NULL, $delta = 0) {
+  global $theme_key;

+  init_theme();
+
   $form['module'] = array('#type' => 'value', '#value' => $module);
   $form['delta'] = array('#type' => 'value', '#value' => $delta);

-  $edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {blocks} WHERE module = '%s' AND delta = '%s'", $module, $delta));
+  $edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {blocks} WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $module, $delta, $theme_key));

   $form['block_settings'] = array(
     '#type' => 'fieldset',

Comments

greenmachine’s picture

I took a different approach to addressing this issue, not wanting to change core code. See what I think is a duplicate issue here and comment from me: http://drupal.org/node/115596#comment-1158733

Tresler’s picture

Status: Active » Closed (duplicate)

Marking as a duplicate of the one he mentioned. There are some differences between the two issues, but the answer, afaik, is the same. It isn't an issue with D6 or D7 and can't be fixed in D5 without breaking forward compatibility.
http://drupal.org/node/115596