WordPress.org

Making WordPress.org

Changeset 3329


Ignore:
Timestamp:
06/11/2016 10:26:40 AM (3 years ago)
Author:
obenland
Message:

Plugin Directory: Show Mine view to authors with one unapproved plugin.

See #1571.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php

    r3232 r3329  
    2424
    2525        /** This filter is documented in wp-admin/includes/post.php */
    26         $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
     26        $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
    2727
    2828        if ( $this->hierarchical_display ) {
     
    381381        }
    382382
    383         $user_post_count = intval( $wpdb->get_var( $wpdb->prepare( "
    384             SELECT COUNT( 1 )
    385             FROM $wpdb->posts
    386             WHERE post_type = %s
    387             AND ( post_author = %d OR post_name IN ( '" . implode( "','", $plugins ) . "' ) )
    388         ", $post_type, $current_user_id ) ) );
     383        if ( empty( $plugins ) ) {
     384            $user_post_count = intval( $wpdb->get_var( $wpdb->prepare( "
     385                SELECT COUNT( 1 )
     386                FROM $wpdb->posts
     387                WHERE post_type = %s
     388                AND post_author = %d
     389            ", $post_type, $current_user_id ) ) );
     390
     391        } else {
     392            $user_post_count = intval( $wpdb->get_var( ($wpdb->prepare( "
     393                SELECT COUNT( 1 )
     394                FROM $wpdb->posts
     395                WHERE post_type = %s
     396                AND ( post_author = %d OR post_name IN ( %s ) )
     397            ", $post_type, $current_user_id, implode( ', ', $plugins ) ) ) ) );
     398        }
    389399
    390400        // Subtract post types that are not included in the admin all list.
Note: See TracChangeset for help on using the changeset viewer.