2

On a user "my account" page, I want to create a view block which lists the blogs created by that user only. Is there a way to accomplish this ?

2

There are solution for it by using Contextual Filter in views. Follow this -

  • Create a new content view and limit it to the content type you want.
  • Uncheck "Create a page" and check "Create a block." Select the format you want.Click "Continue & edit."
  • Add a contextual filter for "Content: Author uid.". Do this --

Under "When the filter value is not available," select "Provide a default value," and select "User ID from URL" from the dropdown. Because blocks don't understand contextual filters very well, the view won't work properly without this default value, and all posts of the given content type will show on all user pages (not just the user's own posts).

Under "When the filter value is available or a default is provided," check "Specify validation criteria" and select "Basic validation" as the validator. Select "Hide view" from the dropdown.

  • Save your view.
  • Assuming that you created a block display, the block will now be available on the Blocks page. Go there and open it.
  • Set your block to display on all user pages (/user/*) in the correct region. Save the block.
  • Your block should now appear on all user pages, showing the content written by each user.

Let me know the result if it works fine :)

|improve this answer|||||
  • It worked absolutely fine and to the requirement. I was doing the same thing but was stuck at the contextual filter part. Thanks a lot for your help. :) – Nikhil Aug 13 '13 at 8:12
  • @Nikhil Welcome :) – RajeevK Aug 13 '13 at 8:28

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.