Changeset 24593
- Timestamp:
- 07/08/2013 08:05:42 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/async-upload.php
r24214 r24593 48 48 if ( 'attachment' != $post->post_type ) 49 49 wp_die( __( 'Unknown post type.' ) ); 50 $post_type_object = get_post_type_object( 'attachment' ); 51 if ( ! current_user_can( $post_type_object->cap->edit_post, $id ) ) 50 if ( ! current_user_can( 'edit_post', $id ) ) 52 51 wp_die( __( 'You are not allowed to edit this item.' ) ); 53 52 -
trunk/wp-admin/edit.php
r24207 r24593 79 79 80 80 foreach( (array) $post_ids as $post_id ) { 81 if ( !current_user_can( $post_type_object->cap->delete_post, $post_id) )81 if ( !current_user_can( 'delete_post', $post_id) ) 82 82 wp_die( __('You are not allowed to move this item to the Trash.') ); 83 83 … … 98 98 $untrashed = 0; 99 99 foreach( (array) $post_ids as $post_id ) { 100 if ( !current_user_can( $post_type_object->cap->delete_post, $post_id) )100 if ( !current_user_can( 'delete_post', $post_id) ) 101 101 wp_die( __('You are not allowed to restore this item from the Trash.') ); 102 102 … … 113 113 $post_del = get_post($post_id); 114 114 115 if ( !current_user_can( $post_type_object->cap->delete_post, $post_id) )115 if ( !current_user_can( 'delete_post', $post_id ) ) 116 116 wp_die( __('You are not allowed to delete this item.') ); 117 117 -
trunk/wp-admin/includes/class-wp-posts-list-table.php
r24576 r24593 481 481 $title = _draft_or_post_title(); 482 482 $post_type_object = get_post_type_object( $post->post_type ); 483 $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID );483 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 484 484 485 485 $alternate = 'alternate' == $alternate ? '' : 'alternate'; … … 586 586 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>'; 587 587 } 588 if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {588 if ( current_user_can( 'delete_post', $post->ID ) ) { 589 589 if ( 'trash' == $post->post_status ) 590 590 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; -
trunk/wp-admin/includes/media.php
r24585 r24593 497 497 if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 498 498 $post = $_post = get_post($attachment_id, ARRAY_A); 499 $post_type_object = get_post_type_object( $post[ 'post_type' ] ); 500 501 if ( !current_user_can( $post_type_object->cap->edit_post, $attachment_id ) ) 499 500 if ( !current_user_can( 'edit_post', $attachment_id ) ) 502 501 continue; 503 502 -
trunk/wp-admin/includes/post.php
r24527 r24593 29 29 $ptype = get_post_type_object( $post_data['post_type'] ); 30 30 31 if ( $update && ! current_user_can( $ptype->cap->edit_post, $post_data['ID'] ) ) {31 if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) { 32 32 if ( 'page' == $post_data['post_type'] ) 33 33 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) ); … … 173 173 174 174 $ptype = get_post_type_object($post_data['post_type']); 175 if ( !current_user_can( $ptype->cap->edit_post, $post_ID ) ) {175 if ( !current_user_can( 'edit_post', $post_ID ) ) { 176 176 if ( 'page' == $post_data['post_type'] ) 177 177 wp_die( __('You are not allowed to edit this page.' )); … … 375 375 $post_type_object = get_post_type_object( get_post_type( $post_ID ) ); 376 376 377 if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( $post_type_object->cap->edit_post, $post_ID ) ) {377 if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( 'edit_post', $post_ID ) ) { 378 378 $skipped[] = $post_ID; 379 379 continue; -
trunk/wp-admin/includes/template.php
r24377 r24593 241 241 function get_inline_data($post) { 242 242 $post_type_object = get_post_type_object($post->post_type); 243 if ( ! current_user_can( $post_type_object->cap->edit_post, $post->ID) )243 if ( ! current_user_can( 'edit_post', $post->ID ) ) 244 244 return; 245 245 -
trunk/wp-admin/post.php
r24304 r24593 140 140 wp_die( __( 'Unknown post type.' ) ); 141 141 142 if ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) )142 if ( ! current_user_can( 'edit_post', $post_id ) ) 143 143 wp_die( __( 'You are not allowed to edit this item.' ) ); 144 144 … … 236 236 wp_die( __( 'Unknown post type.' ) ); 237 237 238 if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )238 if ( ! current_user_can( 'delete_post', $post_id ) ) 239 239 wp_die( __( 'You are not allowed to move this item to the Trash.' ) ); 240 240 … … 260 260 wp_die( __( 'Unknown post type.' ) ); 261 261 262 if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )262 if ( ! current_user_can( 'delete_post', $post_id ) ) 263 263 wp_die( __( 'You are not allowed to move this item out of the Trash.' ) ); 264 264 … … 279 279 wp_die( __( 'Unknown post type.' ) ); 280 280 281 if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )281 if ( ! current_user_can( 'delete_post', $post_id ) ) 282 282 wp_die( __( 'You are not allowed to delete this item.' ) ); 283 283 -
trunk/wp-includes/admin-bar.php
r24214 r24593 430 430 && 'add' != $current_screen->action 431 431 && ( $post_type_object = get_post_type_object( $post->post_type ) ) 432 && current_user_can( $post_type_object->cap->read_post, $post->ID )432 && current_user_can( 'read_post', $post->ID ) 433 433 && ( $post_type_object->public ) 434 434 && ( $post_type_object->show_in_admin_bar ) ) … … 458 458 if ( ! empty( $current_object->post_type ) 459 459 && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) 460 && current_user_can( $post_type_object->cap->edit_post, $current_object->ID )460 && current_user_can( 'edit_post', $current_object->ID ) 461 461 && $post_type_object->show_ui && $post_type_object->show_in_admin_bar ) 462 462 { -
trunk/wp-includes/capabilities.php
r24491 r24593 1163 1163 case 'add_post_meta': 1164 1164 $post = get_post( $args[0] ); 1165 $post_type_object = get_post_type_object( $post->post_type ); 1166 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID ); 1165 $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); 1167 1166 1168 1167 $meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false; … … 1179 1178 $comment = get_comment( $args[0] ); 1180 1179 $post = get_post( $comment->comment_post_ID ); 1181 $post_type_object = get_post_type_object( $post->post_type ); 1182 1183 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID ); 1180 $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); 1184 1181 break; 1185 1182 case 'unfiltered_upload': -
trunk/wp-includes/class-wp-xmlrpc-server.php
r24521 r24593 1018 1018 if ( ! get_post( $post_data['ID'] ) ) 1019 1019 return new IXR_Error( 401, __( 'Invalid post ID.' ) ); 1020 if ( ! current_user_can( $post_type->cap->edit_post, $post_data['ID'] ) )1020 if ( ! current_user_can( 'edit_post', $post_data['ID'] ) ) 1021 1021 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 1022 1022 if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) ) … … 1328 1328 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 1329 1329 1330 $post_type = get_post_type_object( $post['post_type'] ); 1331 if ( ! current_user_can( $post_type->cap->delete_post, $post_id ) ) 1330 if ( ! current_user_can( 'delete_post', $post_id ) ) 1332 1331 return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) ); 1333 1332 … … 1410 1409 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 1411 1410 1412 $post_type = get_post_type_object( $post['post_type'] ); 1413 if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) 1411 if ( ! current_user_can( 'edit_post', $post_id ) ) 1414 1412 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 1415 1413 … … 1506 1504 1507 1505 foreach ( $posts_list as $post ) { 1508 $post_type = get_post_type_object( $post['post_type'] ); 1509 if ( ! current_user_can( $post_type->cap->edit_post, $post['ID'] ) ) 1506 if ( ! current_user_can( 'edit_post', $post['ID'] ) ) 1510 1507 continue; 1511 1508 -
trunk/wp-includes/link-template.php
r24506 r24593 907 907 return; 908 908 909 if ( !current_user_can( $post_type_object->cap->edit_post, $post->ID ) )909 if ( !current_user_can( 'edit_post', $post->ID ) ) 910 910 return; 911 911 … … 961 961 return; 962 962 963 if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) )963 if ( !current_user_can( 'delete_post', $post->ID ) ) 964 964 return; 965 965 -
trunk/wp-includes/query.php
r24456 r24593 2441 2441 } 2442 2442 2443 $edit_cap = 'edit_post'; 2444 $read_cap = 'read_post'; 2445 2443 2446 if ( ! empty( $post_type_object ) ) { 2444 $edit_cap = $post_type_object->cap->edit_post;2445 $read_cap = $post_type_object->cap->read_post;2446 2447 $edit_others_cap = $post_type_object->cap->edit_others_posts; 2447 2448 $read_private_cap = $post_type_object->cap->read_private_posts; 2448 2449 } else { 2449 $edit_cap = 'edit_' . $post_type_cap;2450 $read_cap = 'read_' . $post_type_cap;2451 2450 $edit_others_cap = 'edit_others_' . $post_type_cap . 's'; 2452 2451 $read_private_cap = 'read_private_' . $post_type_cap . 's';
Note: See TracChangeset
for help on using the changeset viewer.