WordPress.org

Making WordPress.org

Changeset 8473


Ignore:
Timestamp:
03/17/2019 12:17:02 AM (13 months ago)
Author:
SergeyBiryukov
Message:

Plugin Directory: Upload: Block plugin submissions if there are approved plugins that have not yet been used.

Props Ipstenu.
Fixes #4294.

File:
1 edited

Legend:

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

    r7604 r8473  
    1212        $plugins = get_posts( array(
    1313            'post_type'      => 'plugin',
    14             'post_status'    => array( 'new', 'pending' ),
     14            'post_status'    => array( 'new', 'pending', 'approved' ),
    1515            'author'         => get_current_user_id(),
    1616            'orderby'        => 'title',
     
    3232
    3333            $submitted_plugins = self::get_submitted_plugins();
    34             $submitted_counts  = (object) array_fill_keys( array( 'new', 'pending' ), 0 );
     34            $submitted_counts  = (object) array_fill_keys( array( 'new', 'pending', 'approved' ), 0 );
    3535
    3636            $submitted_counts->total = count( $submitted_plugins );
     
    4343                    $submitted_plugins[ $key ]->status = __( 'Being Reviewed', 'wporg-plugins' );
    4444                    $submitted_counts->pending++;
     45                } elseif ( 'approved' === $plugin->post_status ) {
     46                    $submitted_plugins[ $key ]->status = __( 'Approved', 'wporg-plugins' );
     47                    $submitted_counts->approved++;
    4548                }
    4649            }
     
    101104                        <p>
    102105                        <?php
    103                         if ( 1 === $submitted_counts->total ) {
    104                             esc_html_e( 'You already have a plugin in the review queue. Please wait for it to be approved before submitting any more.', 'wporg-plugins' );
    105                         } else {
    106                             printf(
    107                                 /* translators: 1: Total amount of plugins; 2: Amount of pending plugins. */
     106                        if ( 0 !== $submitted_counts->approved ) {
     107                            printf(
     108                                /* translators: 1: Amount of approved plugins; 2: URL on how to use SVN */
    108109                                esc_html( _n(
    109                                     'You have %1$s plugins in the review queue, %2$s is being actively reviewed. Please wait for them to be approved before submitting any more.',
    110                                     'You have %1$s plugins in the review queue, %2$s are being actively reviewed. Please wait for them to be approved before submitting any more.',
     110                                    'You have %1$s approved plugin that has not yet been used. We require developers to use the hosting we provide. Please upload your plugin via <a href="%2$s">SVN</a>.',
     111                                    'You have %1$s approved plugins that have not yet been used. We require developers to use the hosting we provide. Please upload your plugins via <a href="%2$s">SVN</a>.',
     112                                    $submitted_counts->approved,
     113                                    'wporg-plugins'
     114                                ) ),
     115                                '<strong>' . $submitted_counts->approved . '</strong>',
     116                                'https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/'
     117                            );
     118                        } elseif ( 0 !== $submitted_counts->pending ) {
     119                            printf(
     120                                /* translators: %s: Amount of pending plugins. */
     121                                esc_html( _n(
     122                                    'You have %s plugin being actively reviewed. You must complete this review before you can submit another plugin.',
     123                                    'You have %s plugins being actively reviewed. You must complete their reviews before you can submit another plugin.',
    111124                                    $submitted_counts->pending,
    112125                                    'wporg-plugins'
    113126                                ) ),
    114                                 '<strong>' . $submitted_counts->total . '</strong>',
    115127                                '<strong>' . $submitted_counts->pending . '</strong>'
     128                            );
     129                        } elseif ( 0 !== $submitted_counts->new ) {
     130                            printf(
     131                                /* translators: %s: Amount of new plugins. */
     132                                esc_html( _n(
     133                                    'You have %s plugin that has been recently submitted but not yet reviewed. Please wait for your plugin to be reviewed and approved before submitting another.',
     134                                    'You have %s plugins already submitted but not yet reviewed. Please wait for them to be reviewed and approved before submitting another plugin.',
     135                                    $submitted_counts->new,
     136                                    'wporg-plugins'
     137                                ) ),
     138                                '<strong>' . $submitted_counts->new . '</strong>'
    116139                            );
    117140                        }
     
    121144                        <ul>
    122145                        <?php
     146                        // List of all plugins in progress.
    123147                        foreach ( $submitted_plugins as $plugin ) {
    124148                            echo '<li>' . esc_html( $plugin->post_title ) . ' &#8212; ' . $plugin->status . "</li>\n";
     
    196220                }
    197221                ?>
    198        
     222
    199223            <?php endif; // ! $submitted_counts->total ?>
    200224
Note: See TracChangeset for help on using the changeset viewer.