WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/03/2010 05:19:39 AM (12 years ago)
Author:
nacin
Message:

Fix "Mine" posts link on edit.php. Adds post_type to URL, and hides auto-drafts from count. props rovo89, fixes #12692.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r13916 r13957  
    144144$user_posts = false;
    145145if ( !current_user_can($post_type_object->edit_others_cap) ) {
    146     $user_posts_count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(1) FROM $wpdb->posts WHERE post_type = '%s' AND post_status != 'trash' AND post_author = %d", $post_type, $current_user->ID) );
     146    $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') AND post_author = %d", $post_type, $current_user->ID) );
    147147    $user_posts = true;
    148148    if ( $user_posts_count && empty($_GET['post_status']) && empty($_GET['all_posts']) && empty($_GET['author']) )
     
    227227    if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user->ID ) )
    228228        $class = ' class="current"';
    229     $status_links[] = "<li><a href='edit.php?author=$current_user->ID'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>';
     229    $status_links[] = "<li><a href='edit.php?post_type=$post_type&author=$current_user->ID'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>';
    230230    $allposts = '&all_posts=1';
    231231}
Note: See TracChangeset for help on using the changeset viewer.