hook_block visibility I have a custom module defining a block which needs some complex page visibility rules that I'll write later. In building out the basic hook_block code the visibility and pages settings don't seem to be working when returning FALSE.

function popup_footer_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $blocks[0] = array(
      'info' =&gt; t('Popup Footer'),
      'visibility' =&gt; 2,
      'pages' =&gt; popup_footer_block_visibility(),
    );

    return $blocks;
  }
  else if ($op == 'view') {
    switch ($delta) {
      case 0:
        $block = array('content' =&gt; 'foo bar');
        break;
    }

    return $block;
  }
}

function popup_footer_block_visibility() {
  return FALSE;
}
When the block visibility is set to 2, $block[0]['pages'] needs to be a string that can be passed to drupal_eval() as first argument. In fact, the code which handles the block visibility is the following one.

  // Match path if necessary
  if ($block-&gt;pages) {
    if ($block-&gt;visibility &lt; 2) {
      $path = drupal_get_path_alias($_GET['q']);
      // Compare with the internal and path alias (if any).
      $page_match = drupal_match_path($path, $block-&gt;pages);
      if ($path != $_GET['q']) {
        $page_match = $page_match || drupal_match_path($_GET['q'], $block-&gt;pages);
      }
      // When $block-&gt;visibility has a value of 0, the block is displayed on
      // all pages except those listed in $block-&gt;pages. When set to 1, it
      // is displayed only on those pages listed in $block-&gt;pages.
      $page_match = !($block-&gt;visibility xor $page_match);
    }
    else {
      $page_match = drupal_eval($block-&gt;pages);
    }
  }