I have set up a block to appear inside this group: http://archstl.org/education — it displays fine for any member of that group who is logged in. But it will not appear if you are logged out, or an anonymous site visitor.

I checked the block settings, and there are no settings for OG Block Visibility besides the 'which groups should this block appear in' setting...

In og_block_visibility.module, line 207, I found the following code:

function og_block_visibility_check($module, $delta) {
  // Are we in a group?
  if ($group = og_get_group_context()) {
    // 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;
      if (in_array($group->nid, array_keys($user->og_groups))) {
        return TRUE;
      }
    }
  }
}

It seems the 'Is the block public?' access check is getting its value from somewhere, but I can't find a way to make a block 'public' or not... and I couldn't find any permissions on the permissions admin page to expose this control on the blocks admin page. Is this simply a missing setting?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wizonesolutions’s picture

Hi there - you probably already figured this out, but thought I'd respond anyway. It has to do with the settings on the Group Node - whether it's at least "Moderated" or not. I don't think this check makes sense because I am, for example, using this module to create sub-sites, so I want people to see blocks as long as they're within the right group but not be able to join the group...basically, it should be transparent. So I'll probably have to patch it if there's nothing already done in the issue queue.

wizonesolutions’s picture

Status: Active » Needs review
FileSize
548 bytes

Here is a patch that, in my opinion, makes the "Is the block public?" check a little smarter. It checks if the group is private or not instead of checking its join settings, which could well not be a good indicator.

Download it to the og_block_visibility module directory and apply it with

patch -p0 < filename

geerlingguy’s picture

Will do.

wizonesolutions’s picture

Cool! Let me know if it works...

pbull’s picture

Successfully tested wizonesolutions' patch #2 with Drupal 6.19 and Organic groups 6.x-2.0.

thePanz’s picture

Tested!