I'm looking to create a entity reference view that filters based upon a field I've placed on the user profile.

I have two content types (Speakers, and Blog Authors) (Speakers will also be blog authors) that I want to as an available list of authors on a Blog content type, so on creation, the speaker can choose the author profile to link the particular blog to, but filtered by only those listed on a particular user's user account.

I've placed an entity reference field on the user account that is a link from a specific user to a specific piece of content of either the Speakers or Blog authors content type (called blog_author_link).

I'm looking to create a view that filters the entity reference field on the blog content type based upon which field is selected in a users profile.

I have a view that successfully lists both content types, but when I attempted to add a relationship from that user account link (blog_author_link), and contextually filter based upon Content:nid and set it to pull from the logged in user's id, it doesnt seem to work. (Yes, There are users that have that attribute assigned, and I've passed those arguments and the filter results in no output). I tried to do a uid, but I dont think that is available on the entity reference view type. I'm a bit over my head.

Any Ideas?

EDIT: Ok, so It seems based upon when I start passing random arguments into the preview's contextual filter that it is looking doing exactly what I'm telling it to do, filter based upon the NID, when I need to filter based on the UID, but there is no contextual filter for the UID under Entity Reference Views type... Any one have any idea what I'm talking about?

up vote 0 down vote accepted

You need to add a relationship to the view. It will either be "node: author" or "content: author" depending on your distro/version (I'm commerce 7, views 3).

Once you've added the relationship, "User: Uid" will be an available option under contextual filters.

  • That does give me the ability to use the UID as a contextual fiter, but I can't link the entity reference field (the bridge between the user profile and list of selected content types) as a reference on the UID filter. It automatically links it to the Content:Author (I'm just using the standard distro and views 3)... Any idea on constructing the view I'm looking for? Thanks Anne. – Billy Gedney Jul 14 '13 at 3:05
  • I think what you're attempting may be a bit beyond my skill level. The only other thing I can suggest is probably something you're already doing: you are setting the relationship on the contextual filter itself - correct? – Anne Bonham Jul 15 '13 at 0:50
  • I have no idea what happened, it wasn't there before, but now the UID shows up without the content:author relationship, and is able to be linked to the blog_author_link entity reference... No idea, but it's working... Thanks for your help Anne. You pointed me in the right direction... – Billy Gedney Jul 15 '13 at 16:34

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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