Ticket #11504: 11504.4.diff
File 11504.4.diff, 2.5 KB (added by , 15 years ago) |
---|
-
post.php
31 31 if ( isset($post_data['trackback_url']) ) 32 32 $post_data['to_ping'] = $post_data['trackback_url']; 33 33 34 if ( !isset($post_data['user_ID']) ) 35 $post_data['user_ID'] = $GLOBALS['user_ID']; 36 34 37 if (!empty ( $post_data['post_author_override'] ) ) { 35 38 $post_data['post_author'] = (int) $post_data['post_author_override']; 36 39 } else { … … 64 67 $post_data['post_status'] = 'draft'; 65 68 if ( isset($post_data['saveasprivate']) && '' != $post_data['saveasprivate'] ) 66 69 $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' ) ) 68 71 $post_data['post_status'] = 'publish'; 69 72 if ( isset($post_data['advanced']) && '' != $post_data['advanced'] ) 70 73 $post_data['post_status'] = 'draft'; 71 74 if ( isset($post_data['pending']) && '' != $post_data['pending'] ) 72 75 $post_data['post_status'] = 'pending'; 73 76 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; 75 84 76 85 // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 77 86 // 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'] ) { 79 88 $publish_cap = 'publish_pages'; 80 89 $edit_cap = 'edit_published_pages'; 81 90 } else { … … 446 455 function wp_write_post() { 447 456 global $user_ID; 448 457 449 if ( 'page' == $_POST['post_type'] ) {458 if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { 450 459 if ( !current_user_can( 'edit_pages' ) ) 451 460 return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) ); 452 461 } else { … … 454 463 return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) ); 455 464 } 456 465 457 458 466 // Check for autosave collisions 459 467 $temp_id = false; 460 468 if ( isset($_POST['temp_ID']) ) {