ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Last comment author name

March 05, 2012 5:58pm

Subscribe [2]
  • #1 / Mar 05, 2012 5:58pm

    Suraj Timalsina

    32 posts

    Hi,
    How can I just display the last comment author I’d in channel entries loop.  I could pull who started entry by {username }  but is there a tag for pulling last comment author id? {recent_comment_date} is there to pull most recent comment but by who? That’s what I want
    Thanks

  • #2 / Mar 06, 2012 6:55pm

    Sean C. Smith

    3818 posts

    Hi Bishnu Timalsina,

    Do you want to list the author of the most recent comment? If so then why not pull the most recent comment and then display the {author} or {author_id} based on that. If this is not what you are trying to do, could you clarify some and add in the code you would like to use.’

    Sean

  • #3 / Mar 07, 2012 10:22pm

    Suraj Timalsina

    32 posts

    Hi Sean,
    I am trying to get the latest comment author name in customer_feedback channel in below code. It lists latest customer feedbacks with who started the post with date it was originally started, total comments, views and the most recent comment date. I also need to pull the most recent comment author. Below is the code. So what would be the tag to pull the most recent comment author name?

    {exp:channel:entries channel="customer_feedback"} 
    {title} By {author} on {entry_date format='%m/%d/%y'} {comment_total} Comments , {view_count_one} Views Last comment by: {author_name or id does not work here…}??? on {recent_comment_date format="%Y %m %d"}
    {/exp:channel:entries}

     

  • #4 / Mar 08, 2012 7:59pm

    Sean C. Smith

    3818 posts

    Hi Bishnu,

    What you are trying to do is not possible with ExpressionEngine out of the box, but I did a search on Devot://ee and found the add-on comments which looks like it will allow you to do what you want.

    Does this help?

    Sean

  • #5 / Mar 09, 2012 2:53am

    Suraj Timalsina

    32 posts

    Hi Sean,
    Thanks for the addons, but for something like this I wanted to keep the EE install base as stock as possible.
    So, here is what I came up with if someone is looking for the same.

    {exp:query sql="SELECT name, author_id as c_author_id, comment_date FROM exp_comments WHERE comment_date = '{recent_comment_date}'"
    By:  {name} on {recent_comment_date format="%F %d, %Y - %g:%i %a"}
    {/exp:query}
  • #6 / Mar 09, 2012 6:11pm

    Sean C. Smith

    3818 posts

    Bishnu,

    glad you found a solution. Thanks for sharing the query code - I’m sure that will come in helpful for others searching in the future. Is there anything else I can assist you with?

    Sean

  • #7 / Mar 14, 2012 9:40pm

    Suraj Timalsina

    32 posts

    Thats it. Thanks Sean

  • #8 / Mar 16, 2012 1:44pm

    Shane Eckert

    7174 posts

    Hello Bishnu,

    I am glad to see that Sean was able to help you.

    If you need anything else, please let us know.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases