Skip to main content

AddToAny

Share/Save

Modify Recent Comments Block in Drupal

When I launched this blog in Drupal, I knew, I would be modifying its "Recent Comments" Block someday. I did'nt like Drupals default "Recent Comments" Block. It only display, subject of the comment with its posted time.

But I wanted a lot more. I wanted to display the "'comment author'(linking to author's homepage) added a 'comment' (linking to comment) to 'Title of the post' (linking to the post) (Time ago). I also wanted to separate Comments according to the node types. Comments on the blog entry and Forums should be shown in a differnt blocks. 

DefaultComments.PNG  TechPintComments.PNG(Default in Drupal) 

I created a view to display comments that were recentlly posted. And with little research, I was able to create the view, without any change in basic view templates. I am attaching the text file of the view, in case you want to give it a try. I was also able to have all Forum comments in a different block. For that you just need to add a Filter Node Type, which is set to Forums.

Happy Drupaling

To import this view, Open http://www.yourdomain.com/admin/build/views/import and Copy this code there.
AttachmentSize
TechPint_Comments.txt6.15 KB

 Thanks for this is a great

 Thanks for this is a great article ;)

Recently I have been seeing

Recently I have been seeing this recent comments on several blogs and was wondering how they were able to do that. I thought it was a plugin or module, but now I did understand the way it is done.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr><br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong><font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption>
  • You can enable syntax highlighting of source code with the following tags: <c>, <cpp>, <csharp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <php>, <python>, <ruby>, <sql>, <tsql>, <vbnet>, <xml>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Lines and paragraphs break automatically.

More information about formatting options