--- modules/block/block.module.614.orig 2008-06-24 15:40:08.000000000 +0100 +++ modules/block/block.module 2009-09-22 17:24:59.000000000 +0100 @@ -257,6 +257,20 @@ function _block_rehash() { // value if the module did not. $block['pages'] = ''; } + /* The settings for custom, visibility, pages and title may have been altered for this block already, + in another theme. We need to retrieve these values so that the new row matches the exitsing block. + It should be acceptable to get these values from any existing row for this module/delta, because + all rows for this block will contain any customised values. However, for safety, and where the + block table has got mis-matched settings from before this addition was applied, we select the rows + ordered by bid, to ensure the earliest row is returned. If the block has not been customised then + this row will contain any values that were provided by the module, so again this is OK. + See http://drupal.org/node/115596 for details */ + if ($existing_block = db_fetch_array(db_query("SELECT bid, theme, custom, visibility, pages, title FROM {blocks} WHERE module = '%s' AND delta = '%s' ORDER BY bid", $module, $delta))) { + $block['custom'] = $existing_block['custom']; + $block['visibility'] = $existing_block['visibility']; + $block['pages'] = $existing_block['pages']; + $block['title'] = $existing_block['title']; + } // Add defaults and save it into the database. drupal_write_record('blocks', $block); // Set region to none if not enabled.