I have the Profile 2 module where a user selects a zip code (which is an entity reference to the content type ZipCode)

The ZipCode content type has an entity reference to a Region content type.

Finally, there is a content type called Schools which has an entity reference to the ZipCode content type.

I would like to display all schools that match the region of the logged in user. Logically this means finding the user's region, and then all schools with the same region, through the zip code...

I can't for the life of me figure out how to do this. Any help would be appreciated.


The easiest way is creating a view for the School content type and add the fields you want to display on your list. Then add:

  1. A reference to the entity that is common between the School content type and the ZipCode content type. If there is no connection between the two, you will also need to add a reference to the Region content type and then to the ZipContent type.

  2. Add an argument or contextual filter for the user ID of the currently logged-in user and limit the number of nodes displayed.

Note: I have sometimes achieved the same result by creating a view (for users) referencing the content types and adding the desired fields.

This is a video about view arguments: http://mustardseedmedia.com/podcast/episode39.

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.