Drupal Commons on D6 - Visibility of 'Group members' and 'Latest group activity' blocks Out of the box the 'Group members' and 'Latest group activity' blocks on the main page of a group are visible to all users regardless of whether one is a member of that group or not.

How can both blocks be displayed only when a user is a member of that group?

Thank you,

Alex
I had an urgent need to fix this issue quickly so I added a few lines of code to one of the Drupal Commons files directly. Once I have more time I plan to extract the functionality into a custom module. Until then this was my fix:


Open file /profiles/drupal_commons/modules/features/common_core/commons_core.blocks.inc
Locate functions '_commons_core_group_activity_block_view()' and '_commons_core_group_members_block_view()'.
Add the following lines before the if statements:

//Determine group nid
 $url_parameter = explode("/", $_GET['q']);
 $group_nid = $url_parameter[1];

//Determine group membership, exclude Admins
 $is_group_member = og_is_group_member($group_nid,$include_admins = FALSE);
Add &amp;&amp; ($is_group_member != '') as second condition to each if statement


If you know a better way please share.

Alex