Changeset 24478
- Timestamp:
- 06/21/2013 06:00:59 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r24414 r24478 66 66 } 67 67 68 if ( ! $update &&isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] )68 if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] ) 69 69 && ! current_user_can( $ptype->cap->edit_others_posts ) ) { 70 71 if ( 'page' == $post_data['post_type'] ) 72 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) ); 73 else 74 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to create posts as this user.' ) ); 75 } 70 if ( $update ) { 71 if ( 'page' == $post_data['post_type'] ) 72 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) ); 73 else 74 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to edit posts as this user.' ) ); 75 } else { 76 if ( 'page' == $post_data['post_type'] ) 77 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) ); 78 else 79 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to create posts as this user.' ) ); 80 } 81 } 82 83 if ( ! empty( $post_data['post_status'] ) ) 84 $post_data['post_status'] = sanitize_key( $post_data['post_status'] ); 76 85 77 86 // What to do based on which button they pressed … … 93 102 $previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false; 94 103 104 $published_statuses = array( 'publish', 'future' ); 105 95 106 // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 96 107 // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. 97 if ( isset($post_data['post_status']) && ( 'publish' == $post_data['post_status']&& !current_user_can( $ptype->cap->publish_posts )) )98 if ( $previous_status != 'publish'|| !current_user_can( 'edit_post', $post_id ) )108 if ( isset($post_data['post_status']) && (in_array( $post_data['post_status'], $published_statuses ) && !current_user_can( $ptype->cap->publish_posts )) ) 109 if ( ! in_array( $previous_status, $published_statuses ) || !current_user_can( 'edit_post', $post_id ) ) 99 110 $post_data['post_status'] = 'pending'; 100 111
Note: See TracChangeset
for help on using the changeset viewer.