« email this entry to a friend | Main | show number of outgoing trackback pings »

show the most recent commentor

One of the little tricks I've implemented is to show the name of the last person to comment on an entry next to the number of comments. This can be done entirely with standard MT tags, although I'm using the MTEntryIfComments plugin to only display the "last by name" part if there are any comments.

Here's my code for a comments pop-up. The part that generates the comment author's name is in bold, and the plugin tags are in red. It's actually pretty simple to do this.

<MTEntryIfAllowComments> |  <a href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>" onClick="OpenComments(this.href);return false">Comments (<$MTEntryCommentCount$><MTEntryIfComments><MTComments lastn="1" sort_order="descend">, last by <$MTCommentAuthor$></MTComments></MTEntryIfComments>)</a> </MTEntryIfAllowComments>

Note: The MTEntryIfComments plugin also allows you to display a different phrase depending on the number of comments, although I'm not using that functionality myself.

Added: A related trick allows you to "plug" the people who commented on the previous entry. You'll need the Glue plugin. Here's the code to put right below your <$MTEntryBody$> tag:

<MTEntryPrevious><MTEntryIfComments><i>Thanks to the following people for commenting on the previous entry: <MTGlueContainer><MTComments><$MTCommentAuthorLink show_email="0"$><MTGlue>, </MTGlue></MTComments></MTGlueContainer></i><br><br></MTEntryIfComments></MTEntryPrevious>

This adds a line at the bottom of your entry that says: Thanks to the following people for commenting on the previous entry: name, name. The Glue plugin is used to avoid having a trailing comma at the end (see here).

The code sets up the context of the previous entry, then checks if there were comments on the previous entry. If so, it displays the plug line and the names of each commentor in turn.

TrackBack

Listed below are links to weblogs that reference show the most recent commentor:

» ENFIM, O "ÚLTIMO POR" from Neto Cury Blog
Depois de vários e cansativos dias de pesquisa, estudo, e bate cabeça pela internet, consegui achar o plugin correto juntamente com alguém que me ensinasse a TAG correta para implementar o sistema de "O ÚLTIMO COMENTÁRIO FOI DE", como vocês... [Read More]

About This Blog

  • Disclaimer: This is a personal site and is not connected with Six Apart, Ltd, the makers of Movable Type
  • Contact me:
  • Readme: What this blog is and is not
  • Reference: Templates for Al-Muhajabah's Islamic Blogs

August 2008

Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            

Tips by Type

Tips by Area

Other ways to read this blog

Feed Subscribe to this blog's feed
(default is RSS 2.0, I also have RSS 1.0 and Atom)

Text-only version
Powered by
Movable Type 3.2