An OSTraining member was setting up the Organic Groups module in Drupal.
They asked us if it was possible to show the members of one particular group. Yes, that's possible using Views.
In fact, Views ships with a default view that is very similar to this task. We're going to clone that view and make some small changes.
- Make sure you have Organic Groups and Views set up.
- Go to Structure > Views.
- Find the "OG members" view.
- Click "Clone".
Look on the right-hand side of the View, under "Advanced".
The key to creating a view of OG members is this relationship: "OG membership: OG membership from User".
- On the left-hand side, click "Add" next to "Filter Criteria".
- Search for "OG membership: Group ID".
- Click "Apply (all displays)".
- Under "Relationship", choose the relationship that is on the view.
- For "Operator", choose the Node ID of the Organic Group you are targeting. Here's a tutorial on finding the Node ID. In my example, the Node ID is 32.
- Save the filter and save your view.
- Your view should now be showing users only from a single Organic Group.