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.
Subscribe to this blog's feed