0

I created a content type Report. One of the fields name is MyUser and field type is EntityReference. For this field, widget type is SelectList and Target type is User.

I added two contents: Content1 and Content2. I selected UserA for the MyUser field in Content1 and I selected UserB for the MyUser field in content 2.

Now, I created a page view to select the content for the logged in user. If userA logged in, he should see only content1 and if userB logged in, he should see only content2. I thought I needed to add a filter criteria/relationship in view.

How to add the filter criteria/relationship to meet the above requirements?

2 Answers 2

2

Add an explicit relationship to the user, and mark it as required. After that you will be able to add a new filter criterion to your view: User: Current.

enter image description here

4
  • 1. Relationship: Add > Entity Reference: Referenced Entity > Marked as Required > Saved the View. 2. Filter Criteria: Add > User: Current > Relationship field displays 'Entity Reference: Referenced Entity' > Select Yes for "Is the logged in" > Saved. 3. Logged in as UserA > I saw only Content1 and Logged in as UserB > I saw only Content2.
    – autop
    Commented Oct 6, 2015 at 20:50
  • So ... question answered? Or did I misread your question? Commented Oct 6, 2015 at 20:55
  • Sorry to confuse you. Question is answered. I also voted you.
    – autop
    Commented Oct 6, 2015 at 21:16
  • Then please mark the answer as "accepted". Commented Oct 6, 2015 at 21:37
0

I'm not sure to understand your problem but for what i've understand you could resolve using Content access module it permit you to associate a specific content type to a role ( user group )

Hope to help you

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.