Make WordPress Core

Ticket #12706: 12706.4.patch

File 12706.4.patch, 3.9 KB (added by Mosterd3d, 9 years ago)

Shows the registered status when 'show_in_admin_status_list' is true

  • src/wp-admin/includes/meta-boxes.php

     
    7777<div class="misc-pub-section misc-pub-post-status"><label for="post_status"><?php _e('Status:') ?></label>
    7878<span id="post-status-display">
    7979<?php
    80 switch ( $post->post_status ) {
    81         case 'private':
    82                 _e('Privately Published');
    83                 break;
    84         case 'publish':
    85                 _e('Published');
    86                 break;
    87         case 'future':
    88                 _e('Scheduled');
    89                 break;
    90         case 'pending':
    91                 _e('Pending Review');
    92                 break;
    93         case 'draft':
    94         case 'auto-draft':
    95                 _e('Draft');
    96                 break;
     80
     81global $wp_post_statuses, $allowed_post_status;
     82
     83foreach($wp_post_statuses as $key => $wp_post_status){
     84        if($key == $post->post_status && $wp_post_status->show_in_admin_status_list){
     85                $allowed_post_status = true;
     86
     87                switch ( $post->post_status ) {
     88                        case 'private':
     89                                _e('Privately Published');
     90                                break;
     91                        case 'publish':
     92                                _e('Published');
     93                                break;
     94                        case 'future':
     95                                _e('Scheduled');
     96                                break;
     97                        case 'pending':
     98                                _e('Pending Review');
     99                                break;
     100                        case 'draft':
     101                        case 'auto-draft':
     102                                _e('Draft');
     103                                break;
     104                        default:
     105                                _e($wp_post_status->label);
     106                }
     107        }
     108        elseif($key == $post->post_status){
     109                _e('Admin Status');
     110                $allowed_post_status = false;
     111        }
    97112}
     113
    98114?>
    99115</span>
    100 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
     116<?php if ( $allowed_post_status && ('publish' == $post->post_status || 'private' == $post->post_status || $can_publish )) { ?>
    101117<a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
    102118
    103119<div id="post-status-select" class="hide-if-js">
    104120<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" />
    105121<select name='post_status' id='post_status'>
    106 <?php if ( 'publish' == $post->post_status ) : ?>
    107 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
    108 <?php elseif ( 'private' == $post->post_status ) : ?>
    109 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
    110 <?php elseif ( 'future' == $post->post_status ) : ?>
    111 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
    112 <?php endif; ?>
    113 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
    114 <?php if ( 'auto-draft' == $post->post_status ) : ?>
    115 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
    116 <?php else : ?>
    117 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
    118 <?php endif; ?>
     122        <?php
     123        foreach($wp_post_statuses as $key => $wp_post_status){
     124                if($wp_post_status->show_in_admin_status_list){
     125                        $selected = $post->post_status ===  $key ? 'selected' : '';
     126                        echo "<option ".$selected."  value='".$key."'>";
     127                        switch ( $wp_post_status ) {
     128                                case 'private':
     129                                        _e('Privately Published');
     130                                        break;
     131                                case 'publish':
     132                                        _e('Published');
     133                                        break;
     134                                case 'future':
     135                                        _e('Scheduled');
     136                                        break;
     137                                case 'pending':
     138                                        _e('Pending Review');
     139                                        break;
     140                                case 'draft':
     141                                case 'auto-draft':
     142                                        _e('Draft');
     143                                        break;
     144                                default:
     145                                        _e($wp_post_status->label);
     146                        }
     147                        echo "</option>";
     148                }
     149        }
     150        ?>
    119151</select>
    120152 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
    121153 <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>