• Resolved jkmuller

    (@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)
  • Thread Starter jkmuller

    (@jkmuller)

    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);
    
    $i=0;
    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
    $i++;
    endforeach;
    ?>`

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