Ticket #22417: 22417.diff
File 22417.diff, 2.1 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/post.php
26 26 if ( $update ) 27 27 $post_data['ID'] = (int) $post_data['post_ID']; 28 28 29 $ptype = get_post_type_object( $post_data['post_type'] ); 30 if ( $update && ! current_user_can( $ptype->cap->edit_post, $post_data['ID'] ) ) { 31 if ( 'page' == $post_data['post_type'] ) { 32 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) ); 33 } else { 34 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to edit posts as this user.' ) ); 35 } 36 } 37 29 38 if ( isset( $post_data['content'] ) ) 30 39 $post_data['post_content'] = $post_data['content']; 31 40 … … 51 60 } 52 61 } 53 62 54 $ptype = get_post_type_object( $post_data['post_type'] ); 55 if ( isset($post_data['user_ID']) && ($post_data['post_author'] != $post_data['user_ID']) ) { 56 if ( $update ) { 57 if ( ! current_user_can( $ptype->cap->edit_post, $post_data['ID'] ) ) { 58 if ( 'page' == $post_data['post_type'] ) { 59 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) ); 60 } else { 61 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to edit posts as this user.' ) ); 62 } 63 } 63 if ( ! $update && isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] ) 64 && ! current_user_can( $ptype->cap->edit_others_posts ) ) { 65 if ( 'page' == $post_data['post_type'] ) { 66 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) ); 64 67 } else { 65 if ( ! current_user_can( $ptype->cap->edit_others_posts ) ) { 66 if ( 'page' == $post_data['post_type'] ) { 67 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) ); 68 } else { 69 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to create posts as this user.' ) ); 70 } 71 } 68 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to create posts as this user.' ) ); 72 69 } 73 70 } 74 71