Making WordPress.org

Changeset 13084


Ignore:
Timestamp:
12/23/2023 07:46:20 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: Don't output the close/disble reason selector twice.

[13033] accidentally caused the close/disable reason selector to display before each button, rather than once.

See #5653.

File:
1 edited

Legend:

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

    r13033 r13084  
    121121                        <?php endif; ?>
    122122
    123                         <?php foreach ( $statuses as $status ) {
    124                                 echo '<p>';
    125 
     123                        <?php if ( array_intersect( $statuses, [ 'closed', 'disabled' ] ) ) { ?>
     124                                <p>
     125                                        <label for="close_reason"><?php _e( 'Close/Disable Reason:', 'wporg-plugins' ); ?></label>
     126                                        <select name="close_reason" id="close_reason">
     127                                                <?php foreach ( $close_reasons as $key => $label ) : ?>
     128                                                        <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $close_reason ); ?>><?php echo esc_html( $label ); ?></option>
     129                                                <?php endforeach; ?>
     130                                        </select>
     131                                </p>
     132                        <?php }
     133
     134                        foreach ( $statuses as $status ) {
    126135                                if ( 'pending' === $status && ! $post->assigned_reviewer ) {
    127136                                        printf(
     
    133142                                }
    134143
    135                                 if ( 'closed' === $status || 'disabled' === $status ) { ?>
    136                                         <p>
    137                                                 <label for="close_reason"><?php _e( 'Close/Disable Reason:', 'wporg-plugins' ); ?></label>
    138                                                 <select name="close_reason" id="close_reason">
    139                                                         <?php foreach ( $close_reasons as $key => $label ) : ?>
    140                                                                 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $close_reason ); ?>><?php echo esc_html( $label ); ?></option>
    141                                                         <?php endforeach; ?>
    142                                                 </select>
    143                                         </p>
    144                                 <?php }
    145 
    146                                 if ( 'rejected' === $status ) { ?>
     144                                if ( $status === 'rejected' ) { ?>
    147145                                        <p>
    148146                                                <label for="rejection_reason"><?php _e( 'Rejection Reason:', 'wporg-plugins' ); ?></label>
     
    156154
    157155                                printf(
    158                                         '<button type="submit" name="post_status" value="%s" class="button set-plugin-status">%s</button>',
     156                                        '<p><button type="submit" name="post_status" value="%s" class="button set-plugin-status">%s</button></p>',
    159157                                        esc_attr( $status ),
    160158                                        self::get_status_button_label( $status )
    161159                                );
    162 
    163                                 echo '</p>';
    164 
    165160                        } ?>
    166161                </div><!-- .misc-pub-section -->
Note: See TracChangeset for help on using the changeset viewer.