I wrote a custom module an extend the theme Genesis Genesis-subtheme + gpannels to get what i need.

My module implements hook_theme to offer a couple of blocks related with some database tables, and located at gpannels regions.
All works fine!! but, some times (from time to time): the page loaded (next to) once cron tasks were ran shows a list of warnings related to blocks and regions not defined for other themes. No matter if the page was called by anonimous visitors or by an admin.
I think that's a bad site behavior. If there is an admin user over admin/build/blocks/... menu, the warning message makes sense. But, as it happens: if an anonimous visitor comes by the first time, and gets the warning message
what can he think on my site?

I got a temporary solution including a couple of changes at blocks.module's line 286. I'm sure it is not a good solution but works. I'll post it and hope we'll have a good one:

My solution:

<?php
/**
 * first wrote a small function to have the $_GET var as array
 * it's usefull because most functions get diferents arguments when uses arg()
 * this function is located in myModule
 */
function arguments_at_client_call(){
  $clientcall = $_GET['q'];
  $ret = (strpos('*'.$clientcall, '/')>0) ? explode('/', $clientcall) : array();
  return $ret;
}

// then the change at line 286
/*286 was:
 drupal_set_message(t('The block %info was assigned to the invalid region %region and has been disabled.', array('%info' => $old_blocks[$module][$delta]['info'], '%region' => $old_blocks[$module][$delta]['region'])), 'warning');
*/
// i replaced with:
if(module_exists('myModule')){ 
              $args = arguments_at_client_call();
              if(in_array('admin', $args)){ // only if we are on admin tasks we recive the warning
                drupal_set_message(t('The block %info was assigned to the invalid region %region and has been disabled.', array('%info' => $old_blocks[$module][$delta]['info'], '%region' => $old_blocks[$module][$delta]['region'])), 'warning');
              }
            }else{ // if no custom module+theme we do not need changes
              drupal_set_message(t('The block %info was assigned to the invalid region %region and has been disabled.', array('%info' => $old_blocks[$module][$delta]['info'], '%region' => $old_blocks[$module][$delta]['region'])), 'warning');
            }
?>

Comments

ibnkhaldun’s picture

Issue summary: View changes

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.