Last comment posted by code snippet

For my MT pals… I’ve noticed that some commenting systems show the last person who posts a comment on an entry and, because I’m the nerdy, jealous type, I wanted that on the blog, so I figured out how to do that in MT.

Here’s the code:

<MTEntryIfAllowComments>
<?
if (<$MTEntryCommentCount$> > 0) {
?>
<MTComments sort_order="ascend" lastn="1"><$MTCommentAuthorLink spam_protect="1"$></MTComments> had the last word | <? } ?><a href=”<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>” onclick=“OpenComments(this.href); return false”><$MTEntryCommentCount$> </a>
          </MTEntryIfAllowComments>

Since it uses a little bit of php code I’m not sure if it will work with .html pages. If you try it and it works let me know.

Also if you’re using any sort of comments plugin you’ll want to change the code for the (<$MTEntryCommentCount$> > 0) part. I use Adam Kalsey’s simplecomments plugin so my code is actually (<MTSimpleCommentCount> > 0).

Posted on 09/09 at 11:19 PM in Geek_Speak

This work is licensed under a Creative Commons License.
Plagiarism makes babies cry.