Index: og_block_visibility.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_block_visibility/og_block_visibility.module,v
retrieving revision 1.13.2.2
diff -u -r1.13.2.2 og_block_visibility.module
--- og_block_visibility.module	22 Jan 2009 14:15:23 -0000	1.13.2.2
+++ og_block_visibility.module	26 Oct 2010 13:30:40 -0000
@@ -55,6 +55,13 @@
     }
 
     $form['#submit'][] = 'og_block_visibility_submit';
+    
+    $form['group_vis_settings']['group_member_visibility'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show this block only to group members.'),
+      '#description' => t('Show this block only within the elected groups and only if the user is a member of the group.'),
+      '#default_value' => variable_get('og_block_vis_'.$module.'_' . $delta . '_member_vis', 0),
+    );    
 
     $form['group_vis_settings']['group_visibility'] = array(
       '#type' => 'checkbox',
@@ -68,7 +75,7 @@
     if ($count > 10) {
       $form['group_vis_settings']['groups'] = array(
         '#type' => 'select',
-        '#title' => t('Groups:'),
+        '#title' => t('Groups'),
         '#default_value' => $groups,
         '#options' => $options,
         '#multiple' => TRUE,
@@ -79,7 +86,7 @@
     else {
       $form['group_vis_settings']['groups'] = array(
         '#type' => 'checkboxes',
-        '#title' => t('Groups:'),
+        '#title' => t('Groups'),
         '#default_value' => $groups,
         '#options' => $options,
       );
@@ -210,15 +217,25 @@
     // Does the current group have this block assigned to it?
     $groups = og_block_visibility_get_assignments($module, $delta);    
     if (in_array($group->nid, $groups)) {
-      // Is the block public?
-      if ($group->og_selective <= OG_MODERATED) {
-        return TRUE;
-      }
       // Is current user a member of this group?
       global $user;
+      // Check if only-members can see this block
+      if ( variable_get('og_block_vis_'.$module.'_' . $delta . '_member_vis', 0) == 1) {
+        if (in_array($group->nid, array_keys($user->og_groups))) {
+          return TRUE;
+        }
+        else {
+          return FALSE;
+        }
+      }
+      
       if (in_array($group->nid, array_keys($user->og_groups))) {
         return TRUE;
       }
+      // Is the group public?
+      if ($group->og_private == 0) {
+        return TRUE;
+      }      
     }
   }
 }

