x
 
Create New Page
 View Previous Changes    ( Last updated by Lisa Wess )

Show Name of Most Recent Commenter

Question:

How can I show the most recent commenters, or each entry, on the index page?

Answer:

From Les, come these instructions on how to show the names of the most recent commenter under each post:

I use the query tag to do it. Here’s the code:

{if comment_total < '1'}


No recent comments
.


{/if}


{if comment_total
> '0'}


     Most recent comments by
: {exp:query sql="SELECT name, comment_id FROM
exp_comments WHERE entry_id = '{entry_id}' ORDER BY comment_date desc
LIMIT 10"
}


    
<a href="http://yourweblog.com/index.php/comments/{entry_id}/
#c{comment_id}"
>{name}</a>


     
{/exp:query}


{
/if}


Obviously you’ll want to change the URL appropriately and you’ll want it
within the {exp:weblog:entries} loops so the entry_id can be passed.

Category:Tricks

Categories: