Hello Shamim,
We want to allow only the users, who have posted at least one listing under the specific custom post type, to access Private Message. If the user posted no listing under the specific custom post type, then we do not want to allow the user to access Private Message.
We want to execute the following or similar code to check if the number of listing under the specific custom post type for the current user is zero, then display the error message and exit Private Message.
if (count_user_posts(get_current_user_id(), ‘jobs’) == 0) {
echo ‘You do not have permission to access message system’;
/* exit Private Message */
}
Please suggest a code to achieve the above check.
Thanks.