Make subgroups block visible only when group has a parent or children.

Last modified: June 11, 2008 - 15:07

1. Go to /admin/build/block/configure/og_subgroups.
2. In Page specific visibility settings select 'Show if the following PHP code returns TRUE (PHP-mode, experts only).'
3. Paste the following code, that returns TRUE if the group has a parent or children.

<?php
   
// Only print this block if the viewed group has a parent or children.
   
if ($node = og_get_group_context()) {
     
$gid = $node->nid;
     
$top = og_subgroups_get_family($gid, 'up');
     
$bottom = og_subgroups_get_family($gid, 'down');
      if (
$top || $bottom) {
        return
TRUE;
      }
    }
?>

 
 

Drupal is a registered trademark of Dries Buytaert.