So I have user accounts and have added some custom fields to the user accounts. One of the fields is 'field_procedures' which is a entity reference to a content type called procedures.

Inside a view now, which is a calendar view, I want to display ONLY the procedure nodes that have been selected in the 'field_procedures' field that match that user. So that I am able to set which procedure nodes that are related to this user and want him to only see the calendar with of that node type he has been selected for.

I can't figure out how to set this up.

| improve this question | | | | |

In Views add a relationship to the "Entity Reference: Referenced Entity", then add a contextual filter for UID with a default value taken from the URL.

See also http://codekarate.com/daily-dose-of-drupal/using-views-entity-reference-module-drupal-7

| improve this answer | | | | |
  • The only option I have for that field in relationships is. Entity Reference: Referencing entity A bridge to the User entity that is referencing Content via field_procedures seems the Referenced item is available for that field. – Atrium Oct 14 '14 at 21:11
  • Is your view of the suer table or the node table? It sounds like it is the user table, and it should be the node table. – fullerja Oct 16 '14 at 11:14
  • So this works for a single entity reference. However the user account has 2 fields that are entity references. If I add another relationship for that other entity reference and a contextual filter with UID for that new reference. Then it displays nothing. It seems that I can display one entity reference or the other but it will not let me display both at the same time. Do you have any ideas on how to fix this? – Atrium Oct 29 '14 at 19:59

Your Answer

