i have this code to limit the comments per user.
<!-- #only one comment -->
<?php 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();
}
?>
How can edit this code to also check if a custom user profile field [phone] is empty? If is empty display a message else display the comment form.
Thank you.
You can check the user meta for the key you want:
get_the_author_meta( 'customfield' )
should give you the information that you can use in your conditional. Assuming customfield would be replaced by phone or whatever your custom field is named.