You can create an easy to use function to do that for you.
Like so:
<?php
function sg_user_posts_by_type($userid, $post_status) {
$args = array(
'numberposts' => -1,
'post_status' => array($post_status),
'author' => $userid
);
$count_posts = count(get_posts($args));
return $count_posts;
}
if (is_user_logged_in()) {
// GET CURRENT USER DATA
$user_id = get_current_user_id();
$user_data = get_userdata($user_id);
$publish_count = sg_user_posts_by_type($user_id, 'publish');
$pending_count = sg_user_posts_by_type($user_id, 'pending');
$draft_count = sg_user_posts_by_type($user_id, 'draft');
echo '
<h3>Hey '.$user_data->last_name.', You got:</h3>
<ul>
<li>'.$publish_count.' published Posts</li>
<li>'.$pending_count.' pending Posts</li>
<li>'.$draft_count.' drafts</li>
</ul>
';
}
?>
you could make it less resource costly if you need to but this should work fine.
Hope this helps 😉