Comment by author plugin

This is a little plugin I've created for Wordpress. This was created to experiment with plugins, so don't expect antything fancy. Just unzip this file to your plugin dir, activate it in the control panel, and a call to the function

gdd_comments_by_author(author_id, number, before, after); 

Where
author_id = the id of the author wich comments you want to show (default set to 1, typically the admin)
number = the number of comments you want to show (default set to 10 million, I know it's a lot)
before = string to put before each result (default is <li>)
after = string to put after each result (default is </li>)

Sound complicated? I've used this myself with the variable $curauth->ID as explained here. The code I used:

<h4>Comments by <?php echo $curauth->nickname; ?></h4>
<?php gdd_comments_by_author($curauth->ID, 100) ?>

download version 0.2

Credits go to Joey Esquivel, the basic query was done by him, I just stole it and put it in a plugin.

10 Responses to “Comment by author plugin”

  1. patung

    Hi Zoute, I wonder if this plugin could be used with my list of "top commenters" on http://www.indonesiamatters.com/. It's like this:

    Top Commenters

    * Hassan (511)
    * Mohammed Khafi (355)
    etc, etc

    What I'd like to do is have the number of comments, like 511, a clickable link that goes to a page with all that person's comments on it.

    Thanks,
    Patung

  2. Hone Watson

    Thanks for the plugin good buddy! I just happened to look today for this plugin and its only a very recent solution.

    Works great!

  3. Hone Watson

    BTW what would also be awesome is some way to paginate the comments of the authors although I imagine that would be quite complicated.

    I just don't have the PHP skill set for that.

  4. Zoute snor

    Patung: I don't know how the list of top commenters is created, but I suppose you could edit the code that generates the list so that it links to an authorpage template, which would contain the function from this plugin.

    Hone Watson: Thanks for the input, I'll look into it somewhere next week, this week is kind of busy for me.

  5. Zoute snor

    And we're two weeks later, but still no time on the hand :(.

  6. buzzdroid

    Nice job. We are using the plugin on our author pages at MyBiggestComplaint. We are using permalinks with the post name. We had to change line 29 of the plugin to read

    echo "post_name."#comment-".$recentcomment->comment_ID."\">".$recentcomment->post_title."";

    Thanks.

  7. Xen

    Awesome plugin. Is prerty permalink support possible?

  8. Xen

    Ok, I solved it i changed to a hre...".get_permalink($recentcomment->ID)." so it uses pretty permalinks :) i think you should use this code in your 0.3 version

  9. Simon

    Xen, although it's relatively easy to use pretty permalinks, the wordpress engine will change the links this plugin creates to pretty permalinks by default. At least that's what it does in my experience.

  10. internet

    Thanks for plugin.. Work Now

Trackbacks

Leave a Reply