Home / The S-Files: "A view that displays a user's content"

The S-Files: "A view that displays a user's content"

UPDATE: I think this recipe is deprecated by the Views Attach module which addresses the use case directly: http://drupal.org/project/views_attach

Tech Support Case Studies

My duties at Acquia include answering the phone when European clients call needing support. Today I helped someone who needed a way for their site users to be able to find the content that they had authored. The recipe I suggested involves making a view that displays all content filtered by a particular user id. By having the view provide a block display you can then put that block on the user's profile page and they always have a place to go to find the latest content that they've created.

I provide an outline of the steps for this view below, but if you are in a hurry you can download the exported view and import it for yourself. You can also download a PDF file of all the screenshots I made while creating the view.

  1. Create a new view. The base table should be nodes.
  2. I modified the display to be HTML list values. I then added the title and type fields. The display and fields you choose, however, can be whatever you need. This is totally up to your needs.
  3. I added an argument. Arguments are bits of information that come in via the URL (path) which tell the view how to filter. In our case we want the view to filter on the user id, so we have to add a User: Uid argument.
  4. The trickiest part of this whole tutorial is how to configure the argument. See page 10 of the PDF for a screenshot. It is important that you choose the option "Action to take if argument is not present: Provide default argument." This is because we're creating a block view, and block views don't automatically take arguments from the URL like other views can. Thus we assume the argument is not present and provide it manually.
  5. Fortunately there is a complimentary option "Default argument type: User ID from URL." That is just what we need! Now the view will know that the integer present in the URL is to be interpreted as the user's id, and that it should use that number to filter the view.
  6. I then added a block display to the view, and saved the view. Don't forget to save the view!
  7. Now it's time to configure the block to appear on the user's profile pages.
  8. Viola! All done.


Acquia helps you succeed in building your websites by providing expert technical advice and support.


Posted on by Boris Mann (not verified).

This might be a good candidate for the expanded D7 install profile (or even part of the per user dashboard in some way). For bonus points, show unpublished status plus quick edit links.

Posted on by Robert Douglass.

Actually, the same client is using the Publish Content module to add those publish/unpublish links. That was in fact, the essence of his use case. I just abbreviated the case study.

Robert Douglass
Senior Drupal Advisor, Acquia

Posted on by PeterZ (not verified).

Great idea. Much appreciated. Implemented on my site as soon as I saw it here.

Posted on by debratrotter (not verified).

Hello Robert, I have some problems with step 4. I checked your PDF but I seem to cannot find the clue. Can you help me out?

Debra@ Anxiety Cures

Posted on by banty (not verified).


I tried to have the same results with comments made by the user. The problem is that it displays the comments made in *own* nodes and not *all* comments.
Any tip on what Fields/Filter can enable a view of a selection of all comments including both of those made on others' nodes as well as own nodes.

Posted on by Robert Douglass.

I think this recipe is deprecated by the Views Attach module which addresses the use case directly: http://drupal.org/projec t/views_attach

Robert Douglass
Senior Drupal Advisor, Acquia