Ticket #20745: 20745.patch
| File 20745.patch, 6.8 KB (added by , 14 years ago) |
|---|
-
wp-admin/includes/class-wp-comments-list-table.php
485 485 $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID]; 486 486 } 487 487 488 if ( current_user_can( 'edit_post', $post->ID ) ) {488 if ( current_user_can( get_post_type_object( $post->post_type )->cap->edit_post, $post->ID ) ) { 489 489 $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>"; 490 490 $post_link .= get_the_title( $post->ID ) . '</a>'; 491 491 } else { -
wp-admin/includes/class-wp-media-list-table.php
162 162 $alt = ''; 163 163 164 164 while ( have_posts() ) : the_post(); 165 $user_can_edit = current_user_can( 'edit_post', $post->ID );165 $user_can_edit = current_user_can( get_post_type_object( $post->post_type )->cap->edit_post, $post->ID ); 166 166 167 167 if ( $this->is_trash && $post->post_status != 'trash' 168 168 || !$this->is_trash && $post->post_status == 'trash' ) … … 355 355 $actions = array(); 356 356 357 357 if ( $this->detached ) { 358 if ( current_user_can( 'edit_post', $post->ID ) )358 if ( current_user_can( get_post_type_object( $post->post_type )->cap->edit_post, $post->ID ) ) 359 359 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>'; 360 if ( current_user_can( 'delete_post', $post->ID ) )360 if ( current_user_can( get_post_type_object( $post->post_type )->cap->delete_post, $post->ID ) ) 361 361 if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { 362 362 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-attachment_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 363 363 } else { … … 365 365 $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-attachment_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 366 366 } 367 367 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 368 if ( current_user_can( 'edit_post', $post->ID ) )368 if ( current_user_can( get_post_type_object( $post->post_type )->cap->edit_post, $post->ID ) ) 369 369 $actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__( 'Attach' ).'</a>'; 370 370 } 371 371 else { 372 if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash )372 if ( current_user_can( get_post_type_object( $post->post_type )->cap->edit_post, $post->ID ) && !$this->is_trash ) 373 373 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>'; 374 if ( current_user_can( 'delete_post', $post->ID ) ) {374 if ( current_user_can( get_post_type_object( $post->post_type )->cap->delete_post, $post->ID ) ) { 375 375 if ( $this->is_trash ) 376 376 $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-attachment_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 377 377 elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) -
wp-admin/media.php
19 19 $attachment_id = (int) $_POST['attachment_id']; 20 20 check_admin_referer('media-form'); 21 21 22 if ( ! current_user_can('edit_post', $attachment_id) )22 if ( ! current_user_can( get_post_type_object( 'attachment' )->cap->edit_post, $attachment_id ) ) 23 23 wp_die ( __('You are not allowed to edit this attachment.') ); 24 24 25 25 $errors = media_upload_form_handler(); … … 53 53 } 54 54 $att_id = (int) $_GET['attachment_id']; 55 55 56 if ( ! current_user_can('edit_post', $att_id) )56 if ( ! current_user_can( get_post_type_object( 'attachment' )->cap->edit_post, $att_id ) ) 57 57 wp_die ( __('You are not allowed to edit this attachment.') ); 58 58 59 59 $att = get_post($att_id); -
wp-admin/revision.php
21 21 22 22 switch ( $action ) : 23 23 case 'restore' : 24 if ( ! $revision = wp_get_post_revision( $revision_id ) )24 if ( ! $revision = wp_get_post_revision( $revision_id ) ) 25 25 break; 26 if ( ! current_user_can( 'edit_post',$revision->post_parent ) )26 if ( ! $post = get_post( $revision->post_parent ) ) 27 27 break; 28 if ( ! $post = get_post( $revision->post_parent) )28 if ( ! current_user_can( get_post_type_object( $post->post_type )->cap->edit_post, $post->ID ) ) 29 29 break; 30 30 31 31 // Revisions disabled and we're not looking at an autosave … … 45 45 if ( !$right_revision = get_post( $right ) ) 46 46 break; 47 47 48 if ( ! current_user_can( 'read_post', $left_revision->ID ) || !current_user_can( 'read_post', $right_revision->ID ) )48 if ( ! current_user_can( get_post_type_object( $left_revision->post_type )->cap->read_post, $left_revision->ID ) || ! current_user_can( get_post_type_object( $right_revision->post_type )->cap->read_post, , $right_revision->ID ) ) 49 49 break; 50 50 51 51 // If we're comparing a revision to itself, redirect to the 'view' page for that revision or the edit page for that post … … 108 108 if ( !$post = get_post( $revision->post_parent ) ) 109 109 break; 110 110 111 if ( ! current_user_can( 'read_post', $revision->ID ) || !current_user_can( 'read_post', $post->ID ) )111 if ( ! current_user_can( get_post_type_object( $revision->post_type )->cap->read_post, $revision->ID ) || ! current_user_can( get_post_type_object( $post->post_type )->cap->read_post, $post->ID ) ) 112 112 break; 113 113 114 114 // Revisions disabled and we're not looking at an autosave -
wp-admin/upload.php
58 58 return; 59 59 60 60 $parent = &get_post( $parent_id ); 61 if ( ! current_user_can( 'edit_post', $parent_id ) )61 if ( ! current_user_can( get_post_type_object( $parent->post_type )->cap->edit_post, $parent_id ) ) 62 62 wp_die( __( 'You are not allowed to edit this post.' ) ); 63 63 64 64 $attach = array(); 65 65 foreach ( (array) $_REQUEST['media'] as $att_id ) { 66 66 $att_id = (int) $att_id; 67 67 68 if ( ! current_user_can( 'edit_post', $att_id ) )68 if ( ! current_user_can( get_post_type_object( 'attachment' )->cap->edit_post, $att_id ) ) 69 69 continue; 70 70 71 71 $attach[] = $att_id;