Changeset 14130 for trunk/wp-admin/includes/post.php
- Timestamp:
- 04/18/2010 04:26:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r14124 r14130 45 45 } 46 46 47 $ptype = get_post_type_object( $post_data['post_type'] ); 47 48 if ( isset($post_data['user_ID']) && ($post_data['post_author'] != $post_data['user_ID']) ) { 48 if ( 'page' == $post_data['post_type']) {49 if ( !current_user_can( 'edit_others_pages' )) {49 if ( !current_user_can( $ptype->edit_others_cap ) ) { 50 if ( 'page' == $post_data['post_type'] ) { 50 51 return new WP_Error( 'edit_others_pages', $update ? 51 52 __( 'You are not allowed to edit pages as this user.' ) : 52 53 __( 'You are not allowed to create pages as this user.' ) 53 54 ); 54 } 55 } else { 56 if ( !current_user_can( 'edit_others_posts' ) ) { 55 } else { 57 56 return new WP_Error( 'edit_others_posts', $update ? 58 57 __( 'You are not allowed to edit posts as this user.' ) : … … 83 82 // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 84 83 // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. 85 if ( isset( $post_data['post_type'] ) && 'page' == $post_data['post_type'] ) { 86 $publish_cap = 'publish_pages'; 87 $edit_cap = 'edit_published_pages'; 88 } else { 89 $publish_cap = 'publish_posts'; 90 $edit_cap = 'edit_published_posts'; 91 } 92 if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( $publish_cap )) ) 93 if ( $previous_status != 'publish' || !current_user_can( $edit_cap ) ) 84 if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( $ptype->publish_cap )) ) 85 if ( $previous_status != 'publish' || !current_user_can( 'edit_post', $post_id ) ) 94 86 $post_data['post_status'] = 'pending'; 95 87
Note: See TracChangeset
for help on using the changeset viewer.