3

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?

16

I finally figured it out:

enter image description here (enlarge image)

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".

  • a brilliant MotoTibe thanks. Ill go give it a go and thanks for the reply – Reg Gordon Apr 14 '13 at 7:58
  • as i feared things seemed to have changed in 7.2. No longer have the Group: Node Group relationship. OG membership: Group Node from OG membership could be what it is now. ill try that – Reg Gordon Apr 14 '13 at 8:09
  • but we also have OG membership: Group User from OG membership. Maybe it could be OG membership: OG membership from Node group though – Reg Gordon Apr 14 '13 at 8:11
  • or Group membership (og_user_node) :( – Reg Gordon Apr 14 '13 at 8:12
1

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)

protected by googletorp Dec 20 '12 at 11:41

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.