Support » Themes and Templates » Query author’s comments

  • Resolved jkmuller


    Is there any way to display the author/user’s last few comments on the author template, or would it require a custom query?

Viewing 1 replies (of 1 total)
  • Solved. My solution was to add this section of code:

    <?php $querystr = "
    SELECT *
    FROM $wpdb->comments
    WHERE $wpdb->comments.comment_author = '".$curauth->user_login."'
    AND comment_approved = '1'
    ORDER BY comment_date DESC";
    $results = $wpdb->get_results($querystr, OBJECT);
    foreach ($results as $comment) :

    Then I added the necessary HTML interspersed with variables such as <?php echo $results[$i]->comment_content; ?>
    I ended with `<?php

Viewing 1 replies (of 1 total)
  • The topic ‘Query author’s comments’ is closed to new replies.