Changeset 2927
- Timestamp:
- 04/11/2016 11:33:19 AM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r2926 r2927 137 137 } 138 138 139 if ( empty( $query->query['post_status'] ) ) { 140 $query->query_vars['post_status'] = array( 'publish', 'future', 'draft', 'pending', 'disabled', 'closed', 'rejected' ); 141 } 142 139 143 if ( ! current_user_can( 'plugin_edit_others' ) || ( isset( $query->query['author'] ) && $query->query['author'] == get_current_user_id() ) ) { 140 144 $query->query_vars['author'] = get_current_user_id(); 145 141 146 $plugins = Tools::get_users_write_access_plugins( get_current_user_id() ); 142 143 147 if ( $plugins ) { 144 148 $query->query_vars['post_name__in'] = $plugins; … … 165 169 166 170 // Allow reviewers to also see all pending plugins. 167 if ( current_user_can( 'plugin_edit_pending' ) && ! isset( $_GET['author']) ) {171 if ( current_user_can( 'plugin_edit_pending' ) && ( ! isset( $_GET['author'] ) || ( isset( $_GET['post_status'] ) && 'pending' === $_GET['post_status'] ) ) ) { 168 172 $where .= " OR {$wpdb->posts}.post_status = 'pending'"; 169 173 } … … 183 187 if ( 'plugin' === $post_type ) { 184 188 $wp_list_table = new Plugin_Posts(); 189 $wp_list_table->prepare_items(); 185 190 } 186 191 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
r2860 r2927 13 13 */ 14 14 protected $plugin_meta; 15 16 /** 17 * 18 * @global array $avail_post_stati 19 * @global WP_Query $wp_query 20 * @global int $per_page 21 * @global string $mode 22 */ 23 public function prepare_items() { 24 global $avail_post_stati, $wp_query, $per_page, $mode; 25 26 $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] ); 27 28 $post_type = $this->screen->post_type; 29 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); 30 31 /** This filter is documented in wp-admin/includes/post.php */ 32 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 33 34 if ( $this->hierarchical_display ) { 35 $total_items = $wp_query->post_count; 36 } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) { 37 $total_items = $wp_query->found_posts; 38 } else { 39 $post_counts = (array) wp_count_posts( $post_type, 'readable' ); 40 41 if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'] , $avail_post_stati ) ) { 42 $total_items = $post_counts[ $_REQUEST['post_status'] ]; 43 } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { 44 $total_items = $this->sticky_posts_count; 45 } elseif ( isset( $_GET['author'] ) && $_GET['author'] == get_current_user_id() ) { 46 $total_items = $this->user_posts_count; 47 } else { 48 $total_items = array_sum( $post_counts ); 49 50 // Subtract post types that are not included in the admin all list. 51 foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { 52 $total_items -= $post_counts[ $state ]; 53 } 54 } 55 } 56 57 if ( ! empty( $_REQUEST['mode'] ) ) { 58 $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; 59 set_user_setting( 'posts_list_mode', $mode ); 60 } else { 61 $mode = get_user_setting( 'posts_list_mode', 'list' ); 62 } 63 64 $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] === 'trash'; 65 66 $this->set_pagination_args( array( 67 'total_items' => $total_items, 68 'per_page' => $per_page 69 ) ); 70 } 15 71 16 72 /**
Note: See TracChangeset
for help on using the changeset viewer.