yes i love technology

Drupal: Hide Navigation on Forum

March 29th, 2007 by Pete

If you want to hide certain Navigational Blocks on your Drupal sites forum(s) here’s how to do it:

1. Go to "Administer » Blocks"
2. Click "configure" on the block you want to hide.
3. On Page specific Visibility Settings click the option for "Show if the following PHP code returns TRUE"
4. Enter the following code in the text area:

PHP:
  1. if (arg(0) == 'node')
  2. {
  3. $node = node_load(array('nid' => arg(1)));
  4. return $node->type != 'forum';
  5. }
  6. elseif (arg(0) == 'forum')
  7. {
  8. return false;
  9. }
  10. else
  11. {
  12. return true;
  13. }
  14. ?>

This will hide the navigation on the forum hompage, when viewing lists of topics and when viewing individual posts (nodes).

# Pete Graham

Posted in Tech, Website Development, php, drupal | 14 Comments »