0

I'm wondering if the following construction is posible with Views in Drupal in combination with relationships. I build this in Drupal:

Manager <--(Entity Reference)--> Group <--(Entity Reference)--> User

A manager can control groups with different users, so I have the following setup:

Manager A <--> Group A <--> User 1
Manager A <--> Group A <--> User 3
Manager A <--> Group A <--> User 5
Manager B <--> Group B <--> User 2
Manager B <--> Group C <--> User 4
Manager B <--> Group C <--> User 6
Manager B <--> Group C <--> User 7

I'm looking for a way to generate a view with the logged in manager to get all the users of the group the manager is part of.

So we get this result when I'm logged in with manager B:

User 2
User 4
User 6
User 7

I tried to create an Contextual filters with an default value of the logged in user. Then 2 relations: one for the

Manager <--(Entity Reference)--> Group

ans an second one for the

Group <--(Entity Reference)--> User

And then I tried to make fields with an relationship. But only I get is no results. Is there a way to get this working?

0

You will want you view set up so that:

  • The view is displaying Users.
  • There is a relationship from User to Group
  • There is a relationship from Group to Manager
  • You add the contextual filter that defaults to the currently logged in user. Make this filter use the Group-Manager relationship.
| improve this answer | |
  • You suggest to use Relation instead of Entity Reference? – Rommel Jan 24 '17 at 11:56
  • @Rommel in Views under Advanced, add relationships that rooby mentions. Keep an eye for Referecing and Referenced, these are two different things. Try using Referenced for both. Else if that doesn't work, try Referecing for both. – No Sssweat Jan 24 '17 at 12:40
  • Thanks for the reply! But I tried it (and I keep an eye for ed and ing) but I keep getting no results... – Rommel Jan 24 '17 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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