Making WordPress.org


Ignore:
Timestamp:
11/14/2017 05:01:46 AM (6 years 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/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r5457 r6118  
    1515
    1616$content = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() );
     17$status  = get_post_status();
    1718
    1819?><article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     
    2526            </div><!-- .plugin-notice -->
    2627        <?php endif; ?>
    27         <?php if ( 'publish' != get_post()->post_status ) :
     28        <?php if ( 'publish' !== $status ) :
    2829                $notice_type = 'notice-error';
    29                 switch ( get_post()->post_status ) {
     30                switch ( $status ) {
    3031                    case 'draft':
    3132                    case 'pending':
     
    4041
    4142                    case 'rejected':
    42                         $message = __( 'This plugin is rejected and is not visible to the public.', 'wporg-plugins' );
     43                        $message = __( 'This plugin has been rejected and is not visible to the public.', 'wporg-plugins' );
    4344                        break;
    4445
    4546                    case 'disabled':
    4647                        if ( current_user_can( 'plugin_approve' ) ) {
    47                             $message = __( 'This plugin is disabled (closed, but actively serving updates) and is not visible to the public.', 'wporg-plugins' );
     48                            $message = __( 'This plugin is disabled (closed, but actively serving updates).', 'wporg-plugins' );
     49                            break;
     50                        } else {
     51                            $message = __( 'This plugin has been closed for new installs.', 'wporg-plugins' );
    4852                            break;
    4953                        }
     
    5155                    default:
    5256                    case 'closed':
    53                         $message = __( 'This plugin is closed and is not visible to the public.', 'wporg-plugins' );
     57                        $message = __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' );
    5458                        break;
    5559                }
     
    5862                <p><?php echo $message; ?></p>
    5963            </div><!-- .plugin-notice -->
     64
     65            <?php if ( in_array( $status, array( 'closed', 'disabled' ) ) && get_current_user_id() == get_post()->post_author ) : ?>
     66                <div class="plugin-notice notice notice-info notice-alt">
     67                    <p><?php
     68                        printf(
     69                            /* translators: 1: plugins@wordpress.org */
     70                            __( 'If you did not request this change, please contact <a href="mailto:%1$s">%1$s</a> for a status. All developers with commit access are contacted when a plugin is closed, with the reasons why, so check your spam email too.', 'wporg-plugins' ),
     71                            'plugins@wordpress.org'
     72                        );
     73                    ?></p>
     74                </div><!-- .plugin-notice -->
     75            <?php endif; ?>
    6076        <?php endif; ?>
    6177
     
    96112            <?php endif; ?>
    97113
    98             <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
     114            <?php if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', get_post() ) ) : ?>
     115                <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
     116            <?php endif; ?>
    99117        </div>
    100118
Note: See TracChangeset for help on using the changeset viewer.