Add ability to show block EXCEPT for selected groups
| Project: | OG Block Visibility |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | paulbooker |
| Status: | closed |
Jump to:
Right now, you can show a block only for a set of selected groups. It would be nice if instead of the current interface you had:
- Three radio buttons: (a) do not use group restrictions (b) show this block ONLY to selected groups (c) show this block to all groups BUT the selected groups.
- The existing list of groups (just as the current interface).
Why is this useful?
Well, og_mandatory_groups is a nice way to be sure everybody belongs to a particular group, let's say "Registered Users". But, this is not a group in the same sense as user-created groups. It makes no sense to have "Manage blocks" for "Registered users", only for REAL groups which visitors perceive as having group-owned content.
While you can assure that the managment blocks are shown ONLY for groups you want, this doesn't quite do it because as users add groups, you then need to be sure somebody updates all relevant blocks. Really, you want to say "Don't show these blocks for the mandatory group" so that, by default, all newly created groups WILL have the block. I hope that's clear. As mud?
Another option would be to add, for og_mandatory_groups, a checkbox saying "hide this group as if it weren't there" (or something like that). That seems a bit of a hack. The above solution seems better.
I looked at the code and was going to create a patch. However, it's not a simple change. Group visibility is determined by the presence of records in og_block_visibility. A new field would need to be added for "restrict" or "allow" and the patch would be pretty significant. So, I thought I'd get it into the issue queue.

#1
#2
I'd like to see this in 5.x as well...
#3
#4
I will not be implementing this feature . If anyone has the time to work on this ill be happy to review.
-Paul
#5
By the way, it's been a long time since I originally wrote this. This problem is now solved very elegantly by the Context module which allows much finer grained control over where blocks appear and is extensible. So, I added "OG Group" sensitivity as a plug-in to the context module (a bit of php in our site-specific extension module).
I'll close this, as I really think this kind of inter-module dependency is best handled by glue modules like context rather than in every module which needs "group sensitivity". Good you postponed it.