Changeset 12873
- Timestamp:
- 01/27/2010 02:34:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r12752 r12873 31 31 if ( isset($post_data['trackback_url']) ) 32 32 $post_data['to_ping'] = $post_data['trackback_url']; 33 34 if ( !isset($post_data['user_ID']) ) 35 $post_data['user_ID'] = $GLOBALS['user_ID']; 33 36 34 37 if (!empty ( $post_data['post_author_override'] ) ) { … … 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'] ) … … 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'; … … 448 457 global $user_ID; 449 458 450 if ( 'page' == $_POST['post_type'] ) {459 if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { 451 460 if ( !current_user_can( 'edit_pages' ) ) 452 461 return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) ); … … 455 464 return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) ); 456 465 } 457 458 466 459 467 // Check for autosave collisions
Note: See TracChangeset
for help on using the changeset viewer.