I'd like to have a select box exposed filter for all organic groups. How do I do this in Views? I only see the data entry option -- no end-user is going to understand that or know the group id.

View is User based.


mstef’s picture

trying to figure this out right now as well..

The only issue I see with this is the potential to have private groups - since the drop-down would have to restrict showing private groups that the current user cannot see.

markabur’s picture

I was looking for the same thing -- I have a list of users and would like to filter it so it only shows members of a certain group, and I need the filter to be a dropdown select list, not a field where you have to type in the group ID.

jessico’s picture

Here is what worked for me:

Admin > Configuration > Account Settings > Manage Fields > Edit the OG Reference (og_group_ref in my case). Under Additional Behaviors, I had to check the "Render Views filters as select list" box.

Then in Views -
1.) Add a relationship for OG membership: OG membership from Node
2.) Add a relationship for OG membership: Group Node from OG membership that uses the relationship OG membership from Node.
3.) Add the filter criteria Field: Groups audience (og_group_ref) and expose it to visitors
4.) Configure the filter to your preference.

(Additionally, I use Better Exposed Filters to make my drop down filters in Views a little more aesthetically pleasing.)

I'm still trying to get my mind around how OG 2.x and Views interact. I wish that I could provide a more elaborate response, but hope this is somewhat helpful.

markabur’s picture

Status: Active » Fixed

@jessico -- thank you! Totally forgot about the "Render Views filters as select list" checkbox in the field settings... that's what I was looking for!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

idcm’s picture

Issue summary: View changes

@jessico -- Thank you!

TravisJohnston’s picture

Status: Closed (fixed) » Active

This is old but still applies to newer versions of OG and Drupal. I followed the directions in #3 and was able to get this working, but only partially. This does not work as expected if you are using Groups and Sub Groups like I am.

I am creating a calendar for a district website that acts like a multisite with OG. The District is the top level group, with each School in the district as subgroups.

This filter only looks at the top level group, so if I toggle District, the events show, if I only toggle a School, no events show.

TravisJohnston’s picture

Status: Active » Closed (fixed)

Nevermind, I fixed it by instead I used:

  • OG membership: Node from OG membership
  • (node from OG membership) OG membership: Group Node from OG membership
  • And the (node from OG membership) Content: Groups audience (exposed) filter
  • Install Better Exposed Filters to get a nice Checkbox instead of a Select List
faite’s picture

Hey guys,

So I can get this exposed filter populating my groups, but only when the user type has the "edit group" or "administer group" permission set for that group type. What can I do so non logged in users can filter content by group? All the content is open and free to look at so I know thats not the reason.

Anyone else run into this issue or have any idea how to utilize the exposed filter dropdown without being an admin?