Ticket #11504: 11504.patch
File 11504.patch, 2.3 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/post.php
37 37 if (!empty ( $post_data['post_author'] ) ) { 38 38 $post_data['post_author'] = (int) $post_data['post_author']; 39 39 } else { 40 $post_data['post_author'] = (int) $post_data['user_ID'];40 $post_data['post_author'] = isset($post_data['user_ID']) ? (int) $post_data['user_ID'] : 0; 41 41 } 42 42 } 43 43 … … 64 64 $post_data['post_status'] = 'draft'; 65 65 if ( isset($post_data['saveasprivate']) && '' != $post_data['saveasprivate'] ) 66 66 $post_data['post_status'] = 'private'; 67 if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( $post_data['post_status'] != 'private') )67 if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( ( isset($post_data['post_status']) && $post_data['post_status'] != 'private' ) || !isset($post_data['post_status']) ) ) 68 68 $post_data['post_status'] = 'publish'; 69 69 if ( isset($post_data['advanced']) && '' != $post_data['advanced'] ) 70 70 $post_data['post_status'] = 'draft'; 71 71 if ( isset($post_data['pending']) && '' != $post_data['pending'] ) 72 72 $post_data['post_status'] = 'pending'; 73 73 74 $previous_status = get_post_field('post_status', isset($post_data['ID']) ? $post_data['ID'] : $post_data['temp_ID']);74 $previous_status = get_post_field('post_status', isset($post_data['ID']) ? $post_data['ID'] : ( isset($post_data['temp_ID']) ? $post_data['temp_ID'] : null ) ); 75 75 76 76 // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 77 77 // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. 78 if ( 'page' == $post_data['post_type'] ) {78 if ( isset($post_data['post_type']) && 'page' == $post_data['post_type'] ) { 79 79 $publish_cap = 'publish_pages'; 80 80 $edit_cap = 'edit_published_pages'; 81 81 } else { … … 445 445 function wp_write_post() { 446 446 global $user_ID; 447 447 448 if ( 'page' == $_POST['post_type']) {448 if ( 'page' == ( isset($_POST['post_type']) ? $_POST['post_type'] : null ) ) { 449 449 if ( !current_user_can( 'edit_pages' ) ) 450 450 return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) ); 451 451 } else {