WordPress.org

Ready to get started?Download WordPress

Forums

show all comments of a user... how? (12 posts)

  1. Dimitris The Greek Lover
    Member
    Posted 3 years ago #

    I prefer it to be shown in author page
    (like this http://www.castellano.gr/?author=1)

    is there any plugin/

  2. Dimitris The Greek Lover
    Member
    Posted 3 years ago #

    up

  3. Please don't bump.

    Comments are stored per-page/post, rather than per user, which means this would be a fairly intensive SQL call to pull up all the comments.

    WP-Stats - http://wordpress.org/extend/plugins/wp-stats/ - can do this, but IIRC it only shows the people with 5+ comments.

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    get_comments()
    http://codex.wordpress.org/Function_Reference/get_comments

    for instance something like this, in author page:

    <?php
    $author_email = get_the_author_meta( 'user_email' ); 
    
    $args = array(
    	'author_email' => $author_email
    );
    $comments = get_comments($args);
    foreach($comments as $comment) :
    	echo('<br />' . $comment->comment_date . '<br />' . $comment->comment_content);
    endforeach;
    ?>
  5. Does that actually work without a post_id though? Interesting.

  6. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    the docu is not very clear - i wonder myself which parameter would take precedence?

    the snippet did return the comments made by the author (local install, not many comments or authors in the system) - obvious only as long he used his email for commenting.

    also interestingly, in contrast to the codex, the argument list of get_comments() in /wp-includes/comment.php does not include the 'author_email'

    173   * The list of comment arguments are 'status', 'orderby', 'comment_date_gmt',
     174   * 'order', 'number', 'offset', and 'post_id'.
  7. Clearly something to experiment with :)

    I would guess that user_id would be a preferable search parameter than the author email, personally.

  8. Dimitris The Greek Lover
    Member
    Posted 3 years ago #

    Ευχαριστώ πάρα πολύ!!!

    Thank you very much...

    I will take a look at thois right ahead and i will respond back

  9. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    @Ipstenu

    I would guess that user_id would be a preferable search parameter than the author email, personally.

    just checked - user_id results in the same comments returned as the corresponding email address.

    hours of fun and joy ahead ;-)

  10. Yeah, but if someone changes their email, you won't have 'em all. Where as user_id remains constant.

  11. Dimitris The Greek Lover
    Member
    Posted 3 years ago #

    there is no author.php in my theme...
    where should i add this code?

  12. Xaliber
    Member
    Posted 2 years ago #

    alchymyth solution is pretty effective!

    I'm really new in WordPress theme development, and I'm wanting to change the author_email to user_id. I've changed all author_email and user_email to user_id, but what it does is showing all comments from all users.

    I've tried reading the codex but didn't find something helpful. Any help here?

Topic Closed

This topic has been closed to new replies.

About this Topic