Make WordPress Core


Ignore:
Timestamp:
06/06/2013 02:39:08 PM (13 years ago)
Author:
markjaquith
Message:

Restore post format previewing.

props azaozz. fixes #24483

File:
1 edited

Legend:

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

    r24408 r24414  
    13531353
    13541354        if ( 'page' == $post->post_type ) {
    1355                 if ( !current_user_can('edit_page', $post_ID) )
    1356                         wp_die(__('You are not allowed to edit this page.'));
     1355                if ( ! current_user_can('edit_page', $post_ID) )
     1356                        wp_die( __('You are not allowed to edit this page.') );
    13571357        } else {
    1358                 if ( !current_user_can('edit_post', $post_ID) )
    1359                         wp_die(__('You are not allowed to edit this post.'));
     1358                if ( ! current_user_can('edit_post', $post_ID) )
     1359                        wp_die( __('You are not allowed to edit this post.') );
    13601360        }
    13611361
    13621362        $user_id = get_current_user_id();
    1363         if ( 'draft' == $post->post_status && $user_id == $post->post_author ) {
     1363        $locked = wp_check_post_lock( $post->ID );
     1364        if ( ! $locked && 'draft' == $post->post_status && $user_id == $post->post_author ) {
    13641365                $id = edit_post();
    13651366        } else { // Non drafts are not overwritten. The autosave is stored in a special post revision.
     
    13721373                wp_die( $id->get_error_message() );
    13731374
    1374         if ( $_POST['post_status'] == 'draft' && $user_id == $post->post_author ) {
     1375        if ( ! $locked && $_POST['post_status'] == 'draft' && $user_id == $post->post_author ) {
    13751376                $url = add_query_arg( 'preview', 'true', get_permalink($id) );
    13761377        } else {
    13771378                $nonce = wp_create_nonce('post_preview_' . $id);
    1378                 $url = add_query_arg( array( 'preview' => 'true', 'preview_id' => $id, 'preview_nonce' => $nonce ), get_permalink($id) );
     1379                $args = array(
     1380                        'preview' => 'true',
     1381                        'preview_id' => $id,
     1382                        'preview_nonce' => $nonce,
     1383                );
     1384
     1385                if ( isset( $_POST['post_format'] ) )
     1386                        $args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] );
     1387
     1388                $url = add_query_arg( $args, get_permalink($id) );
    13791389        }
    13801390
Note: See TracChangeset for help on using the changeset viewer.