I have a list of authors and a list of comment authors for a given post. What I want to be able to do is show the latest comment made by an author. Can anyone help me? Well out of my php depth!
This is the various bit of code I am using. All this inside the loop.
<?php // These are the post authors ?>
<div>
<?php coauthors_nicknames(); coauthors_IDs() ?>
<br />
</div>
<?php // These are the IDs for the approved comments for this post ?>
<div>
<?php
$comment_array = get_approved_comments($post->ID);
foreach($comment_array as $comment){
echo $comment->comment_ID." => ".$comment->comment_post_ID."\n";
}
?>
</div>
<?php // These are the IDs for the approved comments for this post ?>
<div>
<?php
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");
foreach( $comments as $comment ) :
?>
<?php comment_author(); ?>
<?php endforeach; ?>
</div>