functions – Verification is the user author of the number of messages?

I have this function …

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

} else if ((in_category (& # 39; Locked & # 39;)) && in_array (& # 39; subscriber & # 39 ;, (array) $ user-> roles)) {
/ * Is subscribed, is in the category Locked, does not have the number of posts * /
echo & # 39;
You subscribe without a number of messages!
& # 39 ;; } else if (in_category (& # 39; Locked)) { / * IS NOT subscribed, belongs to the category Locked, has NO amount of messages * / echo & # 39;
Log in or register pal!
& # 39 ;; } other { / * IS NOT a subscriber, is NOT in the Locked category, has NO amount of items * / echo do_shortcode (& # 39;[shortcode_name]& # 39;); }

I need to apply "to the number of messages" or "check if the user is the author of the message number" on the first part of the code …

if ((in_category (& # 39; Locked & # 39;)) && in_array (& # 39; subscriber & # 39 ;, (array) $ user-> roles)) && ?????

If this method did not work, I would have an additional possible solution, it is to automatically move the subscriber user into a contributor once the subscriber has posted the number of publications, but this first solution would be preferable.