WordPress.org

Making WordPress.org


Ignore:
Timestamp:
11/14/17 05:01:46 (5 weeks ago)
Author:
SergeyBiryukov
Message:

Plugin Directory: Allow closed/disabled plugins to have a public page.

  • Add a notice explaining the plugin's current status.
  • Add noindex meta tag.
  • Remove Download button and Previous Versions section.

Props tellyworth, jipmoors, Ipstenu, SergeyBiryukov.
See #2627.

File:
1 edited

Legend:

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

    r5867 r6118  
    4545        add_filter( 'the_content', array( $this, 'filter_rel_nofollow' ) ); 
    4646        add_action( 'wp_head', array( Template::class, 'json_ld_schema' ), 1 ); 
    47         add_action( 'wp_head', array( Template::class, 'meta_description' ), 1 ); 
     47        add_action( 'wp_head', array( Template::class, 'output_meta' ), 1 ); 
    4848        add_action( 'wp_head', array( Template::class, 'hreflang_link_attributes' ), 2 ); 
    4949 
     
    318318        register_post_status( 'disabled', array( 
    319319            'label'                     => _x( 'Disabled', 'plugin status', 'wporg-plugins' ), 
    320             'public'                    => false, 
     320            'public'                    => true, 
    321321            'show_in_admin_status_list' => current_user_can( 'plugin_disable' ), 
    322322            'label_count'               => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'wporg-plugins' ), 
     
    330330        register_post_status( 'closed', array( 
    331331            'label'                     => _x( 'Closed', 'plugin status', 'wporg-plugins' ), 
    332             'public'                    => false, 
     332            'public'                    => true, 
    333333            'show_in_admin_status_list' => current_user_can( 'plugin_close' ), 
    334334            'label_count'               => _n_noop( 'Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'wporg-plugins' ), 
     
    789789 
    790790        // For singular requests, or self-author profile requests allow restricted post_status items to show on the front-end. 
    791         if ( $wp_query->is_main_query() && ( $viewing_own_author_archive || is_user_logged_in() && !empty( $wp_query->query_vars['name'] ) ) ) { 
     791        if ( $wp_query->is_main_query() && ( $viewing_own_author_archive || is_user_logged_in() && ! empty( $wp_query->query_vars['name'] ) ) ) { 
    792792 
    793793            $wp_query->query_vars['post_status'] = array( 'approved', 'publish', 'closed', 'disabled' ); 
     
    817817                return $posts; 
    818818            }, 10, 2 ); 
     819        } 
     820 
     821        // Allow anyone to view a closed plugin directly from its page. It won't show in search results or lists. 
     822        if ( $wp_query->is_main_query() && ! empty( $wp_query->query_vars['name'] ) ) { 
     823            $wp_query->query_vars['post_status'] = (array) $wp_query->query_vars['post_status']; 
     824            $wp_query->query_vars['post_status'][] = 'closed'; 
     825            $wp_query->query_vars['post_status'][] = 'disabled'; 
     826            $wp_query->query_vars['post_status'] = array_unique( $wp_query->query_vars['post_status'] ); 
    819827        } 
    820828 
Note: See TracChangeset for help on using the changeset viewer.