0

I have users that have profiles using Profile2 module. I created a content type called Projects. A user can add a project, it has fields: title, description, and file. I would like to add a view to the users profile page that lists all of their Projects.

How can I connect the profile to the content author and use a contextual filter to get only that users content when viewing their profile?

Any help is greatly appreciated.

Edit: An example to clarify: If user1 is logged in and views his profile he will see a list of his projects.

If user1 views user2's profile he will see a list of user2's projects.

1 Answer 1

1

In the views UI

  • Your view must be a view of nodes
  • Then, add a relationship with the node's author (the relation is: Content: Author)
  • Then, add an other relationship : select user and check profile. Then you can use the profile node in Contextual filters or Filter criteria. The technic part is that it is a relationship of relationship ;)
3
  • I want to filter on the current profile being viewed, not the current user logged in.
    – Dan
    Commented Sep 11, 2013 at 14:40
  • other help : drupal.stackexchange.com/questions/85156
    – pico34
    Commented Sep 11, 2013 at 14:48
  • I set up the relationships you suggested, but used Author ID as the contextual filter criteria, and it works nicely. Thanks for the help.
    – Dan
    Commented Sep 11, 2013 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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