How to not print a Menu Block if a Menu Block exists I've been using a whitelist/blacklist PHP script to control the display of 2 different menu blocks, and its becoming bloated.

Menu_block 1 is the primary menu.
Menu_block 2 is the supplementary menu.

I'm trying set the block visibility for Menu_block 1 via PHP - IF Menu_block 2 exists return FALSE, else return TRUE.
Print Menu_block 1 unless Menu_block 2 exists.

PHP visibility for Menu_block 1

&lt;?php
  if(isset($block = module_exists('menu_block', 'block', '2')) {
    return FALSE;
  }
  return TRUE;
?&gt;


I'm not even sure if this is actually possible.
I had the same issue and resolved it by removing one of the blocks by calling  template_preprocess_page() in a custom module or in your theme's template.php. What I do is check to see if both blocks exist on the page, and if so, call unset() on the block I want to remove:

function mymodule_preprocess_page(&amp;$variables) {
//Remove secondary menu block if tertiary menu block is on the page
if(!empty($variables['page']['sidebar_first']['menu_block_tertiary']) &amp;&amp; !empty($variables['page']['sidebar_first']['menu_block_secondary'])) {
    unset($variables['page']['sidebar_first']['menu_block_secondary']);
}


The indexes in your $variables array will most likely be different. On my site, 'sidebar_first' is the region in my theme where my menu blocks (menu_block_primary and menu_block_secondary) are placed. If you're not sure what your variables are, you can use a call to dpm($variables) to find them (Make sure you you have the devel module enabled) like so:

function mymodule_preprocess_page(&amp;$variables) {
  dpm($variables);
}