How do I create a view of Nodes that a logged in user is a member of? Is this enforced in Relationships or Contextual Filters? That is, can you explain how group membership is enforced via relationships and contextual filters?
2 Answers
Organic Groups are providing a set a views already configured and ready to use. What you are looking for is one of these views, specifically this view: OG User groups
of Type: OG membership
.
You may create a clone of this view (is a good practice to keep the original view intact, mainly for reference) under admin/structure/views
and set it (fields, filters etc) according to your needs. You may also explore the relationships
and contextual filters
and see how are set. Note that the type is OG membership. A handy thing to add to your view is the (un) subscribe link
from/to group. This is found in fields as:Content: Group
with formatter 'OG subscribe link
' .
Lastly, keep in mind that the OG's: OG User groups
view is a content pane
, not a page
. This means that if you want to place your group's page
under a menu you'll have to create a view page
with a path.
Organic Groups module also provides an API and set of functions. The documentation page page also constitutes a great reference.
Hope that helps!
Organic Groups provises a default view for this called "OG User Groups". You can use that as a base and adapt it accordingly.
-
Thank you. Upvote. This is an excellent start to a finished solution. Would you mind explaining– RickFeb 9, 2016 at 14:24
-
If you place the default view as a block, does it give the desired result? Feb 9, 2016 at 14:51