0

Suppose you have a content type called political party. Political parties can have members that are users. A user can be a member of multiple political parties.

I am trying to create a view where I list every user that is a member of a political party, and list them each only once. I don't need to see what party they are in, and this should just be a newest user sorted list of users that are listed in at least one political party's member field.

So these are the content types that need to be related:

party
   |-members (user reference list)
user

How would you construct a view for this using the views module? I am a little lost on how to tackle this.

(note: I am using political parties, but actual content type name is different. It just is easier to explain this way)

2 Answers 2

1

I'm not entirely positive this is the type of relationship you want for this data. If you use a node_reference field on the user rather than a user_reference on the node it would be pretty straightforward to create a view of Users who party.

Query all users and then add a Relationship to the field_party node reference. Require the relationship with a Delta of 1.

enter image description here

This type of reference would seem to make more sense for your use case as well, since this would enable any user to administer their own party affiliations rather than the party manage the list (but then this is an analogy and I don't know the particulars).

Either way you are hitting up against the boundaries of what is possible using references. I'd encourage you to take a look at the Relation Module which is designed to handle these kinds of bi-directional relationships, e.g. Display the members of the Party, Display the parties an individual is a member.

1

If the users are actual people that are going to be adding themselves to these groups then it sounds like you might have better luck with the Flag Module.

This will allow uses to 'join' any political party node by flagging it, and you can setup a view that will show only users that have flagged the particular node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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