I have a view showing a list of nodes of type group. How do I set it up to show the count of members that belong to each group?
I finally figured it out:
The steps are:
- create a view for "content" type "group". Use "fields" and show "content:title", that's the name of your group
- add relationship "Group: Node group" (required), then "(group) Organic groups group: OG membership" (required).
- add filter "(OG membership) OG membership: Entity_type " and set to "is equal" to "user"
- "use aggregation"
- add field "(OG membership) OG membership: Entity id" and use "count distinct" option. That's your count of members.
If you want the count of nodes that are "linked" to a group you would just change the filter from "user" to "node".
I have discovered something that might help. In the header section of the view, click on "add" and choose "OG membership: Group membership overview". That single entry will add something that looks like the following:
Group overview - Group manager: admin - Total members: 4 - Total content: 0
I desperately need those to be individually available in the "fields" section of the view where if can be displayed with more flexibility ... and per row.
I will dig into the code and add those views fields. Hopefully things go well. If so, I will post the code back here, and a patch on the OG project page, or an custom module.
I am starting to think that Drupal module builders seriously need to organize focus groups regarding the usability and the necessity of some new features. The OG seems so disconnected from the end users needs that I am starting to have serious doubt about using it. Unfortunately, there is no alternative that I know of.
(Note from different user: Had this exact same problem, and comment #62 on this issue worked for me: https://drupal.org/node/1101102#comment-7404856)