I have two content types. Blog and Author. On Blog content type I have entity reference field (blog_author) where admin can find author of the blog (Author content type).

Now I have a view that is supposed to show Author image and name (fields on Author content type) on the sidebar of blog post. The settings I have on my view:

Filters (published) Relationships (referencing field blog_author), require this relationship.

But when I go see blog page it always show same author on each blog post (newest Author). Is my relationship somehow wrong? Should it be "referenced field blog_author" as there is two different entity reference for this field. EDIT: Though I did try this but with same result. So this is why I'm bit baffled now that how to do it. I thought relatioship would be enough but do I need to use contextual filters with this too?

Views settings: enter image description here

Relationship: enter image description here

  • I am curious... it would have taken less time to try the other option you mention (the other entity reference), then to write it out here, so why haven't you tried that other option yet? – Geoff May 3 '15 at 19:06
  • Actually I did try it too. Sorry I just wrote it badly. I'll edit original question a bit. – user995317 May 3 '15 at 19:31
  • since we can't see and work the view, can you show a screenshot of the view set up as a whole, and the relationship set up? might provide enough info to give you more guidance... – Geoff May 3 '15 at 19:33
  • Yep, added screenshots. This is the way it is currently. Now it get's the latest author profile on all blog posts (even if for some blog posts different author is set (field_blog_author)) – user995317 May 3 '15 at 19:46

Assuming the author of the blog is the same as the field and content type 'author' when a blog is created, I would suggest using core profile information for the author and use the Author Pane Module:

Author Pane is a block of information about a given user, like those typically found on a forum post, but can be used in other places as well. From core, it collects the user picture, name, join date, online status, contact link, and profile information. In addition, any module or theme can feed it more information via the preprocess system. All of this information is then gathered and displayed using a template file.

  • Yes, but we use already author content type for other stuff, so core profile information is not possible to use (or there is point to use them, since all needed info is on author profiles already). – user995317 May 3 '15 at 19:02
  • unless there's a very specific reason for it, it sounds like poor design, since the user profile is already built, and there are oodles of contrib modules that integrate with it already... just an opinion. – Geoff May 3 '15 at 19:07
  • Yes I agree. The way things are done previously is not good way. But unfortunately need to live with it. – user995317 May 3 '15 at 19:30
  • gotcha - inheriting sites can be frustrating – Geoff May 3 '15 at 19:31

Got it working.

Contextual Filter: Content: Nid (set to "do not use a relationship"; default value of "content ID from URL") Relationship: Entity reference: Referenced entity with "require this relationship"

And then most important thing was that I removed all the fields that I had selected before and reselected and added require above relationship. First time around I didn't remove fields but I just tried to add the relationship but it just didn't show any content. Removing the fields and reassigning them did the trick.

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.