Post lists table: When counting a user's posts, use get_post_stati() instead of hardcoded internal statuses.

props creativeinfusion.
fixes #24818.


git-svn-id: https://develop.svn.wordpress.org/trunk@25676 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-10-03 00:59:12 +00:00
parent f6138dc287
commit 635a1249f5
1 changed files with 2 additions and 1 deletions

View File

@ -57,9 +57,10 @@ class WP_Posts_List_Table extends WP_List_Table {
$post_type_object = get_post_type_object( $post_type );
if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
$exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) );
$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
SELECT COUNT( 1 ) FROM $wpdb->posts
WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
WHERE post_type = %s AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
AND post_author = %d
", $post_type, get_current_user_id() ) );