Drupal 7: Displaying authored content in user profile using Views

There are several ways on how to allow visitors to view all post by a certain user in Drupal 7. Here is a step by step guide on how to display authored content in user profile using Views module.

Step 1 - Allow visitors to view user profile. Go to "People -> Permission" (admin/people - PERMISSIONS tab). Scroll down to User section and select View user profiles for ANONYMOUS USER.

Step 2 - Assuming that you already had Views module with associated modules installed, now create a new view: Structure -> Views -> Add new view (url:admin/structure/views/add).

Step 3 - Fill in "View name" and description. Show Content (default select from dropdown list) of type and choose your preferred content type from dropdown list. Untick "Create a page" instead tick "Create a block". Enter "Block title" and choose "Display format" from dropdown list. You can change this to your like later if you want. Edit anything that you want and click "Continue & Edit" button.

Step 4 - FIELDS - Add your content fields, title, picture and whatever you want.

Step 5 - FILTER CRITERIA - Add filter Type, Publish and however you want.

Step 6 - BLOCK SETTINGS - Access: Permission | View publish content.

Step 7 - Click Advanced link (column on the right) and add CONTEXTUAL FILTERS. Choose Content: Author uid. Apply. On "When the filter value is NOT available", choose Provide default value and in "Type" dropdown list, choose User ID from URL. Click Apply.

Step 8 - Now go to Structure -> Block (url: admin/structure/block) and scroll down to "Disabled" block. Locate the block that you just created (the block name start with View: Name). Click configure and on "Show block on specific pages", choose "Only the listed pages". In the text box type users/* and Save block. Place it in the "Content" region or whatever region you want. Save block.

That's it.

Now, to verify, open a new tab in your browser and type your-website/users/username in the url.

Tag: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.