Checking is user author of number of posts?

I have this function…

$user = wp_get_current_user();
if (( in_category(‘Locked’) ) && in_array( ‘subscriber’, (array) $user->roles ) ) {
/* Is subscriber, is in category Locked, has amount of posts */
echo do_shortcode(‘[shortcode_name]’);

} else if (( in_category(‘Locked’) ) && in_array( ‘subscriber’, (array) $user->roles ) ) {
/* Is subscriber, is in category Locked, has NO amount of posts */
echo ‘<div id=”locked”>
You are subscriber without number of posts!
</div>’;

} else if ( in_category(‘Locked’) ) {
/* Is NOT subscriber, is in category Locked, has NO amount of posts */
echo ‘<div id=”locked”>
Login or register pal!
</div>’;

} else {
/* Is NOT subscriber, is NOT in category Locked, has NO amount of posts */
echo do_shortcode(‘[shortcode_name]’);
}

I need to apply “has amount of posts” or “check if user is author of numebr of posts” on first part of code…

if (( in_category(‘Locked’) ) && in_array( ‘subscriber’, (array) $user->roles ) ) && ?????

If this way can’t work, I would have one more possible solution, it is to auto move user from subscriber to contributor once subscriber posted number of posts, but this first solution would be better.

Read more here:: Checking is user author of number of posts?

Leave a Reply

Your email address will not be published. Required fields are marked *