Advertisements

count_user_posts

Definition:
function count_user_posts($userid) {}

Number of posts user has written.

Parameters

  • int $userid: User ID.

Return values

returns:Amount of posts user has written.

Defined filters

  • get_usernumposts
    apply_filters('get_usernumposts', $count, $userid)

Source code

function count_user_posts($userid) {

	global $wpdb;



	$where = get_posts_by_author_sql('post', TRUE, $userid);



	$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );



	return apply_filters('get_usernumposts', $count, $userid);

}

738

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: