Make subgroups block visible only when group has a parent or children.
Last updated on
30 April 2025
You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules
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.
// 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;
}
}
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion