2

I know how to create a view that filters nodes that were authored by the current user. What I want to do is filter based on the author of a node that has a relationship with the node.

For example: My view has a filter to show nodes of type A type A has a field that is a reference to type B I want a filter that shows nodes (of type A) where the referenced type B node was authored by the current user.

In D6, I did this by creating a relationship to B, then adding a filter where (B)User=Current (that is, User = current with a relationship to type B). I can't figure out how to do this in D7.

So far I have created a relationship to "Content:Author" which does not allow me to define a relationship to type B. Then I created a filter for "(author) User: Current (Yes)" but this appears to be filtering based on the author if my type A nodes.

I've tried googling, but can't seem to come up with the right keywords.

  • Are you using entity reference module for creating relationship between type A and Type B. – Jayendra Kainthola Apr 17 '13 at 16:06
  • Sorry, I'm not sure I fully understand, but the bit about D6/D7 stands out. There is, to the best of my knowledge, no large differences in how relationships are handled between D6 and D7. You should be able to implement the exact same solution in D7. – Letharion Oct 17 '14 at 6:25
1

If I correctly understand the requirement then you are missing the relationship between content type 1 and 2

You need a view of nodes with:

  • A filter that only shows node of type A.
  • A relationship from node type A to node type B via your reference field.
  • A relationship from node type B to its author user.
  • A filter to restrict the user author (of content b) to the current user.

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.