One comment per user email per post

Try this, the code below will generate every comment by the $current_user->user_email for the author_email, if the $usercomment return something, then there is a comment by the current user so echo “thank you”, but if it’s not return anything output the form.

global $current_user,$post;

$usercomment = get_comments(array('author_email' => $current_user->user_email, 'post_id' => $post->ID));

if($usercomment) {
    echo "Thank You";
}
else {
    comment_form();
}

Leave a Comment