0
votes

I'm trying to create a view that filters the resulting pages (content type) based on the association of the same entity of the current logged in user.

This is my situation in detail:

  1. user: field_organizations (n) (Entity reference field to Content type : Organization)
  2. page: field_organization (1) (Entity reference field to Content type : Organization)

for example:

Users

  1. Alice: field_organizations = [o1, o2, o3]

  2. Bob - field_organizations = [o2, o3]

  3. Charlie - field_organizations = [o1]

Pages

  • page1: organization = o1
  • page2: organization = o1
  • page3: organization = o2
  • page4: organization = o3

The view should return the following results:

  • Alice = [page1, page2, page3, page4]
  • Bob = [page3, page4]
  • Charlie = [page1, page2]

I already tried to create a view (of users) that based on the current user ID (contextual filter) returns only the organizations associated to that user, but the problem is that I cannot use this view in the field_organization of the content type page to filter the results. It requires a view of content not a view of users.

Creating a view of organization I'm not able to reach the current user ID through the contextual filter.

Someone can suggest me an alternative solution? thx

1

1 Answers

0
votes

From the first glance, it looks like you should set up a relationship between users and content types in the "Relationship" section of the view.
In addition look at this module - Views Field View. Maybe it will be helpful for you.