Changeset 3093
- Timestamp:
- 05/06/2016 06:56:40 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r3091 r3093 170 170 } 171 171 172 if ( ! current_user_can( 'plugin_edit_others' ) || ( isset( $query->query['author'] ) && $query->query['author'] == get_current_user_id() ) ) {173 $query->query_vars['author'] = get_current_user_id(); 174 175 $plugins = Tools::get_users_write_access_plugins( get_current_user_id());172 $user = wp_get_current_user(); 173 174 if ( ! current_user_can( 'plugin_approve' ) && empty( $query->query['post_status']) || ( isset( $query->query['author'] ) && $query->query['author'] == $user->ID ) ) { 175 $plugins = Tools::get_users_write_access_plugins( $user ); 176 176 if ( $plugins ) { 177 177 $query->query_vars['post_name__in'] = $plugins; … … 201 201 202 202 // Allow reviewers to also see all pending plugins. 203 if ( current_user_can( 'plugin_edit_pending' ) && ( ! isset( $_GET['author'] ) || ( isset( $_GET['post_status'] ) && 'pending' === $_GET['post_status']) ) ) {204 $where .= " OR {$wpdb->posts}.post_status = 'pending'";203 if ( current_user_can( 'plugin_edit_pending' ) && ( ! isset( $_GET['author'] ) || ( isset( $_GET['post_status'] ) && in_array( $_GET['post_status'], array( 'draft', 'pending' ) ) ) ) ) { 204 $where .= " OR {$wpdb->posts}.post_status IN ('draft', 'pending')"; 205 205 } 206 206 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
r3009 r3093 330 330 $mine = ''; 331 331 332 $plugins = Tools::get_users_write_access_plugins( get_current_user_id());332 $plugins = Tools::get_users_write_access_plugins( $current_user_id ); 333 333 $plugins = array_map( 'sanitize_title_for_query', $plugins ); 334 334 $exclude_states = get_post_stati( array( … … 336 336 ) ); 337 337 338 if ( ! current_user_can( 'plugin_approve' ) ) { 339 $exclude_states = array_merge( $exclude_states, array( 340 'publish' => 'publish', 341 'closed' => 'closed', 342 'rejected' => 'rejected', 343 'private' => 'private', 344 ) ); 345 } 346 338 347 $user_post_count = intval( $wpdb->get_var( $wpdb->prepare( " 339 348 SELECT COUNT( 1 ) 340 349 FROM $wpdb->posts 341 350 WHERE post_type = %s 342 AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )343 351 AND ( post_author = %d OR post_name IN ( '" . implode( "','", $plugins ) . "' ) ) 344 352 ", $post_type, $current_user_id ) ) ); … … 350 358 351 359 if ( $user_post_count && $user_post_count !== $total_posts ) { 352 if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id )) {360 if ( isset( $_GET['author'] ) && $_GET['author'] == $current_user_id ) { 353 361 $class = 'current'; 354 362 } … … 370 378 ); 371 379 372 if ( ! current_user_can( 'plugin_ edit_others' ) && ! current_user_can( 'plugin_edit_pending' ) ) {380 if ( ! current_user_can( 'plugin_review' ) ) { 373 381 $status_links['mine'] = $this->get_edit_link( $mine_args, $mine_inner_html, 'current' );; 374 382 return $status_links; … … 410 418 } 411 419 420 if ( ! current_user_can( 'plugin_approve' ) && ! in_array( $status_name, array( 'draft', 'pending' ) ) ) { 421 continue; 422 } 423 412 424 if ( isset($_REQUEST['post_status']) && $status_name === $_REQUEST['post_status'] ) { 413 425 $class = 'current'; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-capabilities.php
r3080 r3093 38 38 39 39 } else { 40 if ( 'pending' == $post->post_status ) { 41 $required_caps[] = 'plugin_edit_pending'; 40 41 if ( in_array( $post->post_status, array( 'draft', 'pending' ) ) ) { 42 $required_caps[] = 'plugin_review'; 42 43 43 44 } else { 44 $required_caps[] = 'plugin_ edit_others';45 $required_caps[] = 'plugin_approve'; 45 46 } 46 47 } … … 78 79 'plugin_set_tags' => true, 79 80 'plugin_add_committer' => true, 81 'plugin_edit_others' => true, 80 82 ); 81 83 … … 86 88 87 89 $admin = array_merge( $reviewer, array( 88 'plugin_add_committer' => true,89 'plugin_edit_others' => true,90 90 'plugin_approve' => true, 91 91 'plugin_reject' => true,
Note: See TracChangeset
for help on using the changeset viewer.