You could simply modify your query to get recent posts by currently logged in user :
<?php
if( is_user_logged_in() ) :
global $current_user;
get_currentuserinfo();
$querystr = "
SELECT comment_ID, comment_post_ID, post_title, comment_content
FROM $wpdb->comments, $wpdb->posts
WHERE user_id = $current_user->ID
AND comment_post_id = ID
AND comment_approved = 1
ORDER BY comment_ID DESC
";
$comments_array = $wpdb->get_results($querystr, OBJECT);
if( $comments_array ): ?>
<h2>Your Recent Posts</h2>
<ul>
<?php
foreach ( $comments_array as $comment ):
setup_postdata( $comment );
echo "<li><a href='". get_bloginfo( 'url' ) ."/?p=".$comment->comment_post_ID."'>Comment on ". $comment->post_title. "</a><br />". $comment->comment_content . "</li>";
endforeach; ?>
</ul><?php
endif;
endif;
?>
Thread Starter
vhf
(@kortchnoi)
Any advice would still be greatly appreciated 😉