WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Comment Leader Hack

[Resolved] Comment Leader Hack

  • Not real familiar with WP yet, so alert me of any problems.
    Download
    wp_comment_leaders
    Tag
    <?php get_comment_leaders(); ?>
    Arguments Definition:

    1. A number that limits the amount of records that are to be shown. (default’s ‘5’)
    2. A string that excludes certain names from appearing in the list. Separate multiple names with a comma.
    3. A number: pads the visitor’s total comment count with zeros.
    4. A string to display before the record.
    5. A string to display after the record. (default is a line break ‘
      ‘)
    6. Example
      <?php get_comment_leaders( 10, "admin_name, spammer_name", 3, '

    7. ', '
    8. '); ?>

Viewing 15 replies - 1 through 15 (of 39 total)
  • Sweet script. Good work.
    I tweaked it a little to the output format I wanted.
    You can see it here: http://www.orbitjuice.com

    Also… I edited the code for multiple and single comments.
    i.e.:
    Eric left 15 comments
    Will left 8 comments
    John left 2 comments
    Mary left 1 comment

    thanks 🙂

    Yea I liked what you did so I changed it to look similar to yours… also made it so that it recognizes single and multiple, comments.also. Thanks

    1. A number that limits the amount of records that are to be shown. (default’s ‘5’)
    2. A string that excludes certain names from appearing in the list. Separate multiple names with a comma.
    3. A string to display before the record.
    4. A string to display between the record. (default “-“)
    5. A string to display after the record. (default is a line break ‘
      ‘)

    Example
    <?php get_comment_leaders( 10, “admin_name, spammer_name”, ‘

  • ‘, ‘posted’, ‘
  • ‘); ?>

Here is mine. It’s a little different. It changes on the output.
if ($author_comment_count != 1) {
echo “$before$comment_author_link – $author_comment_count comments$after”;
} else {
echo “$before$comment_author_link – $author_comment_count comment$after”; }

Thanks for this…another thing to play with. 😉

I love this hack. I would like to make som modifications to it, but I’m unsure how. I’d like my output to look like this:
Jess – 184 total
last commented: (date of last comment)
on entry: (entry title last commented on w/link to entry)
Is there a way to do this?

The portion of the function that figures the last comment by an author doesn’t work. I was going to try to fix the query, but it’s not an easy one.

Yeah I was having the same problem too. With the “Last” section.

MtDew, do you write all the hacks around here? 😉 Or just know everything? ‘Cuz you are all over the board helping everyone. What a guy! =)
Thanks for all your help!

I just try to help out as much as I can. 🙂

Daisyhead yes you can i’ll post how to do it in a sec when I figure out whats going on….. MtDewVirus, What exactly isn’t working correctly? I don’t see the problem that you are talking about.

The query doesn’t exactly pull the ID and comment_ID for the last comment by a visitor. At least not from my testing of it. The GROUP BY messes this up. I ran into a similar problem with a hack I wrote and was able to fix it by callin for MAX(comment_ID), but then how do you get the correct ID? You can’t pull the MAX(ID) because the latest post commented on by a visitor may not be their latest comment. See what I mean?
I was running the query through phpMyAdmin, trying to get the correct results but so far have been unable to.

You guys are great! I can live without the last date commented. I don’t mean to be such a pest. Maybe I just need to tweak my output so it will say:
Jess – 184 total
last on entry: (entry title last commented on w/link to entry)
Is there a way to change that?

Hey Daisyhead
Does the “Last” at the end of your comments leader actually works? and bring up the latest comment by that user?

Viewing 15 replies - 1 through 15 (of 39 total)
  • The topic ‘[Resolved] Comment Leader Hack’ is closed to new replies.
Skip to toolbar