I want to display the articles created by user in user profile page. It should also display to anonymous user also.

For example : twitter.com/google displays all tweets by google.

Like that I want to display xyz.com/john. I want to display all articles created by john in user profile page.

I also want to know how to add that view to profile page.

  • If you plan on embedding this view on the profile page, then you will either need to do a little coding, or install and use a module to assist, such as Panels, Display Suite, or something more lightweight if your prefer (ie a module that can embed a view on the user profile page). If, on the other hand, you just want a tab on the user profile page, then you can do it entirely within views. Dec 17 '14 at 6:16
  • Create a view for content of type all
  • Inside the view display node title and all other fields as per your requirement.
  • Add a contextual filter content : author uid
  • While adding that you will have a option for provide a default value
  • select that option and inside that use filter by 'currently logged in user'.
  • Save it by this you will be able to see all the nodes of current logged in user.
  • Inside the path you can enter just any path like '/my-nodes'. and you are done.
  • If you want you can avoid providing default value and switch to manual input by placing the path as '/my-nodes/%' and then just add contextual filter as 'content : author:uid' without default value(depends as per the requirement).
  • For user name you can add a relationship content author:uid then
    in the contextual filter use User name with relationship author:uid
  • There are a few issues with this. The path should be user/% or users/% as it needs to display on user profile page, or it should be a content pane to embed directly on user profile page. Then currently logged in user will also not work, as the content by the owner of the user profile needs to be displayed, even to anonymous. Dec 17 '14 at 5:49

Add a contextual filter to your view:

User: Uid (if it is not available -> define a relationship to User)

Now select in the section "When the filter value is NOT available" the value "Provide default value" and choose "User ID from url". Additionally you can specify a validation criteria to accept UIDs and user names.

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.