Changeset 4213
- Timestamp:
- 10/11/2016 06:42:46 AM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r4212 r4213 531 531 } 532 532 533 // For singular requests, or self-author profile requests allow restricted post_status items to show on the front-end. 534 if ( is_user_logged_in() && ( 535 !empty( $wp_query->query_vars['name'] ) || 536 ( 537 !empty( $wp_query->query_vars['plugin_contributor'] ) && 538 ( 539 current_user_can( 'plugin_review' ) || 540 0 === strcasecmp( $wp_query->query_vars['plugin_contributor'], wp_get_current_user()->user_nicename ) 541 ) 542 ) ) 543 ) { 544 $wp_query->query_vars['post_status'] = array( 'pending', 'approved', 'publish', 'closed', 'disabled' ); 545 546 add_filter( 'posts_results', function( $posts, $this_wp_query ) use( $wp_query ) { 547 if ( $this_wp_query != $wp_query ) { 548 return $posts; 549 } 550 551 $restricted_access_statii = array_diff( $wp_query->query_vars['post_status'], array( 'publish' ) ); 552 foreach ( $posts as $i => $post ) { 553 // If the plugin is not in the restricted statuses list, show it 554 if ( 'plugin' != $post->post_type || ! in_array( $post->post_status, $restricted_access_statii, true ) ) { 555 continue; 556 } 557 558 // Plugin Reviewers can see all sorts of plugins 559 if ( current_user_can( 'plugin_review' ) ) { 560 continue; 561 } 562 563 // Original submitter can always see 564 if ( $post->post_author == get_current_user_id() ) { 565 continue; 566 } 567 568 // Committers (user_login) can always see 569 if ( in_array( wp_get_current_user()->user_login, (array) Tools::get_plugin_committers( $post->post_name ), true ) ) { 570 continue; 571 } 572 573 // Contributors (user_nicename) can always see 574 if ( in_array( wp_get_current_user()->user_nicename, (array) wp_list_pluck( get_the_terms( $post, 'plugin_contributors' ), 'slug' ), true ) ) { 575 continue; 576 } 577 578 // everyone else can't. 579 unset( $posts[ $i ] ); 580 } 581 582 return $posts; 583 }, 10, 2 ); 584 } 585 586 // By default, all archives are sorted by active installs 533 587 if ( $wp_query->is_archive() && empty( $wp_query->query_vars['orderby'] ) ) { 534 588 $wp_query->query_vars['orderby'] = 'meta_value_num'; -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php
r4200 r4213 28 28 <div class="plugin-notice notice notice-warning notice-alt"> 29 29 <p><?php _e( 'This plugin <strong>hasn’t been updated in over 2 years</strong>. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.', 'wporg-plugins' ); ?></p> 30 </div><!-- .plugin-notice --> 31 <?php endif; ?> 32 <?php if ( 'publish' != get_post()->post_status ) : 33 $notice_type = 'notice-error'; 34 switch ( get_post()->post_status ) { 35 case 'draft': 36 case 'pending': 37 $message = __( 'This plugin is requested and not visible to the public yet. Please be patient as your plugin gets reviewed.', 'wporg-plugins' ); 38 $notice_type = 'notice-info'; 39 break; 40 41 case 'approved': 42 $message = __( 'This plugin is approved and awaiting data upload but not visible to the public yet. Once you make your first commit, the plugin will become public.', 'wporg-plugins' ); 43 $notice_type = 'notice-info'; 44 break; 45 46 case 'rejected': 47 $message = __( 'This plugin is rejected and is not visible to the public.', 'wporg-plugins' ); 48 break; 49 50 case 'disabled': 51 if ( current_user_can( 'plugin_approve' ) ) { 52 $message = __( 'This plugin is disabled (closed, but actively serving updates) and is not visible to the public.', 'wporg-plugins' ); 53 break; 54 } 55 // fall through 56 default: 57 case 'closed': 58 $message = __( 'This plugin is closed and is not visible to the public.', 'wporg-plugins' ); 59 break; 60 } 61 ?> 62 <div class="plugin-notice notice <?php echo esc_attr( $notice_type ); ?> notice-alt"> 63 <p><?php echo $message; ?></p> 30 64 </div><!-- .plugin-notice --> 31 65 <?php endif; ?>
Note: See TracChangeset
for help on using the changeset viewer.