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?
Comment | File | Size | Author |
---|---|---|---|
#2 | og_block_visibility_811088_improve_check_1.patch | 548 bytes | wizonesolutions |
Comments
Comment #1
wizonesolutionsHi 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.
Comment #2
wizonesolutionsHere 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
Comment #3
geerlingguy CreditAttribution: geerlingguy commentedWill do.
Comment #4
wizonesolutionsCool! Let me know if it works...
Comment #5
pbull CreditAttribution: pbull commentedSuccessfully tested wizonesolutions' patch #2 with Drupal 6.19 and Organic groups 6.x-2.0.
Comment #6
thePanz CreditAttribution: thePanz commentedTested!