It’s not difficult. However, I looked through the code iterations in get_usernumposts() and though it appears this was a problem in 1.2.x, 1.5 should be reporting the correct number of posts. At least, get_usernumposts() in 1.5.2 (what’s the version you’re running?) shows to be checking post_status to verify a post is ‘published.’
This is a duplicate of the function–place it somewhere at the beginning of the template:
<?php
function get_userpublishedposts($userid) {
global $wpdb;
return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid' AND post_status = 'publish'");
}
?>
Then change the place in the template which displays it to:
<?php if(get_userpublishedposts($user->ID) > 0) : ?>
Number of posts: <a href="<?php get_author_link(true, $user->ID, "$user->user_nicename"); ?>"><?php echo get_userpublishedposts($user->ID); ?></a>