Hi,

i'm working on a project using search_api and organic group. I'm having trouble to configure a view with a search index that filter content the user can see.

  • My view is using a display of fields of a certain entity type
  • Each entity is attached through organic group to a group or several
  • Each user has one or several groups

My problem is that i can't see how to link every organic group of the user to the view and make it filter on this groups.

May i have some help please ?

Adrien.

Comments

adripop’s picture

Issue summary: View changes
Ludo.R’s picture

I've just done it, you need to index the "Groups audience" field (og_group_ref by default) to your search index.

Then in the view:

  • Add a contextual filter "Indexed Node: Groups audience"
  • Set "Provide default argument "
  • Set "The OG groups of the logged in user"
  • Check "Allow multiple values" in the "More" fieldset

But then you will only get results that are in the user's groups. No more "free" content.
That's a problem for me.