Training

Our next U.S. stop:

Mike Anello and Andrew Riley from Mediacurrent are teaming up to offer the first Blue Collar Git workshop on Friday, June 8 as part of DrupalCamp Charlotte (also part of the Southeast LinuxFest). The cost is only $149 for the full day if you register during the month of May ($199 otherwise). 

New Podcast

Posted Wednesday, May 9 at 7:50 am
Brandon Morrison (Brandonian on drupal.org) joins Andrew Riley and Mike Anello on the first post-DrupalCon Denver edition of the podcast to talk about all things Geo in Drupal 7. Brandon is one of the maintainers of the GeoField module and is an active member of the Drupal Geo community.
Download Podcast 82
DrupalEasy_ep82_20120509.mp3
Syndicate content

Newsletter

Stay up-to-date on DrupalEasy workshops and other events. On average, we send about one newsletter per month.

Testimonial

Mike is a great teacher!

Who are we?

DrupalEasy is the collective expertise of Ryan Price and Michael Anello, who joined forces to provide training and consulting services worldwide. Read all about them and what they can do.

What is Drupal?

Drupal is a free, super-powerful content management system for sites that require information posting and collection, including blogs, forums, videos, photos, and databases of information. We think it is the best platform available. Here's why...

Why Drupal?

More and more savvy organizations are going with Drupal for content management, and its no mystery why. It’s free, flexible, and easy to maintain for small or large volume sites. Learn more...

Showcase a User's Comments with Views and Menu Tabs

By now, you should know and love the Tracker module that comes with core. It has its strengths, but many weaknesses. For one, you can't separate out posts from comments, or sort the list in interesting ways. Views can help you make exactly the list you want, and place it in a tab on the user's profile exactly like the "Track" tab.

For this example, you'll be adding a list of comments. Creating the view is simple enough:

  1. Clone the default view comments_recent, and call it comments_by_user
  2. On the Page display, add a Relationship for Comment:User
  3. Add an Argument for User: UID and choose Relationship: User (assuming you did not re-name the realtionship)
  4. Before saving the Argument, set the Action to take if argument is not present to be "Provide default argument", then choose "User ID from URL"
  5. Change the page's Path to "user/%/comments"
  6. Give the page a Menu entry by clicking the text that says "No Menu" and choose "Menu Tab", then name the tab "Comments"
  7. Make sure you save the view
  8. Visit any user's page, and you should now see a "Comments" tab next to "View"

For more information about creating views with Relationships, read Mike's article.

Trackback URL for this post:

http://drupaleasy.com/trackback/213
Your rating: None Average: 4.9 (7 votes)

More Quicktips


1 comment

Guest wrote 2 years 36 weeks ago

Thanks

I was just boggled trying to find the UID argument on a comment view and turned to Google, which brought me here. Working great, now, thanks. :)

Michelle

Syndicate content