I found this very useful being that I wanted to have as certain domain for administration purposes only and the rest of my sites to only show content. This means getting rid of the Log In block and the Navigation block.

Here is what I used in the 'Set Visibility' section for "LogIn" and "Navigation" when setting up the block visibility; (replace the zeros with your domain or ip address)

global $base_url;
if ($base_url == 'http://00.00.00.00'){
  return TRUE;
} else {
  return FALSE;
}

I now have one web site or domain that has access to all blocks and menus for administering the Drupal install, content, blocks and settings. And the rest of my web sites or domains just list content like news web sites. Works for all blocks!

Comments

feddovdm’s picture

For others out there, i created this for displaying a block on multi domains. For expanding your domain list, just submit it behind the $allowed array.

global $base_url;
$allowed = array('http://www.domainname.nl','http://www.domainname.de');
$valid=FALSE;
  if(in_array($base_url, $allowed)) {
    $valid=TRUE;
  }
return $valid;
freelylw’s picture

Thanks for the code above. I put the code for the block in panel , and it works

My question is how can I use this code for the block which display in the sidebar? Where should I put this code ??

Thank you