WordPress.org

Make WordPress Core

Changeset 12873


Ignore:
Timestamp:
01/27/10 14:34:11 (6 years ago)
Author:
ryan
Message:

Fix notices when publishing with QuickPress. Props nacin, hakre. fixes #11504

File:
1 edited

Legend:

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

    r12752 r12873  
    3131    if ( isset($post_data['trackback_url']) ) 
    3232        $post_data['to_ping'] = $post_data['trackback_url']; 
     33 
     34    if ( !isset($post_data['user_ID']) ) 
     35        $post_data['user_ID'] = $GLOBALS['user_ID']; 
    3336 
    3437    if (!empty ( $post_data['post_author_override'] ) ) { 
     
    6568    if ( isset($post_data['saveasprivate']) && '' != $post_data['saveasprivate'] ) 
    6669        $post_data['post_status'] = 'private'; 
    67     if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( $post_data['post_status'] != 'private' ) ) 
     70    if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( !isset($post_data['post_status']) || $post_data['post_status'] != 'private' ) ) 
    6871        $post_data['post_status'] = 'publish'; 
    6972    if ( isset($post_data['advanced']) && '' != $post_data['advanced'] ) 
     
    7275        $post_data['post_status'] = 'pending'; 
    7376 
    74     $previous_status = get_post_field('post_status',  isset($post_data['ID']) ? $post_data['ID'] : $post_data['temp_ID']); 
     77    if ( isset( $post_data['ID'] ) ) 
     78        $post_id = $post_data['ID']; 
     79    elseif ( isset( $post_data['temp_ID'] ) ) 
     80        $post_id = $post_data['temp_ID']; 
     81    else 
     82        $post_id = false; 
     83    $previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false; 
    7584 
    7685    // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 
    7786    // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. 
    78     if ( 'page' == $post_data['post_type'] ) { 
     87    if ( isset( $post_data['post_type'] ) && 'page' == $post_data['post_type'] ) { 
    7988        $publish_cap = 'publish_pages'; 
    8089        $edit_cap = 'edit_published_pages'; 
     
    448457    global $user_ID; 
    449458 
    450     if ( 'page' == $_POST['post_type'] ) { 
     459    if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { 
    451460        if ( !current_user_can( 'edit_pages' ) ) 
    452461            return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) ); 
     
    455464            return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) ); 
    456465    } 
    457  
    458466 
    459467    // Check for autosave collisions 
Note: See TracChangeset for help on using the changeset viewer.