Make WordPress Core


Ignore:
Timestamp:
06/05/2013 03:01:59 AM (11 years ago)
Author:
azaozz
Message:

Post locks:

  • When a post is locked, ensure the 'Go back' button doesn't reload the same screen. If no referrer, change the button from 'Go back' to 'Go to All Posts'/'Go to All Pages' etc.
  • Remove restriction on checking locks only for posts.

See #23697.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r24388 r24408  
    12031203    }
    12041204
     1205    if ( $locked && ( $sendback = wp_get_referer() ) &&
     1206        false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
     1207
     1208        $sendback_text = __('Go back');
     1209    } else {
     1210        $sendback = admin_url( 'edit.php' );
     1211
     1212        if ( 'post' != $post->post_type && ( $post_type_object = get_post_type_object( $post->post_type ) ) ) {
     1213            $sendback .= '?post_type=' . $post->post_type;
     1214            $sendback_text = sprintf( _x('Go to All %s', 'post type general name: Posts, Pages, etc.'), $post_type_object->labels->name );
     1215        } else {
     1216            $sendback_text = __('Go to All Posts');
     1217        }
     1218    }
     1219
    12051220    $hidden = $locked ? '' : ' hidden';
    12061221
     
    12301245        <?php do_action( 'post_lock_text', $post ); ?>
    12311246        <p>
    1232         <a class="button" href="<?php echo esc_url( wp_get_referer() ); ?>"><?php _e('Go back'); ?></a>
     1247        <a class="button" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a>
    12331248        <a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
    12341249        <?php
     
    12551270            </p>
    12561271            <?php do_action( 'post_lock_text', $post ); ?>
    1257             <p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( admin_url('edit.php') ); ?>"><?php _e('Go to All Posts'); ?></a></p>
     1272            <p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a></p>
    12581273        </div>
    12591274        <?php
Note: See TracChangeset for help on using the changeset viewer.