Make WordPress Core

Ticket #44581: 44581.2.diff

File 44581.2.diff, 1.3 KB (added by kirasong, 6 years ago)

Refresh of 44581.diff.

  • src/wp-admin/async-upload.php

    diff --git a/src/wp-admin/async-upload.php b/src/wp-admin/async-upload.php
    index 4d37f7f644..626e9a2adf 100644
    a b if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) 
    4545        if ( 'attachment' != $post->post_type ) {
    4646                wp_die( __( 'Invalid post type.' ) );
    4747        }
    48         if ( ! current_user_can( 'edit_post', $id ) ) {
    49                 wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
    50         }
    5148
    5249        switch ( $_REQUEST['fetch'] ) {
    5350                case 3:
    if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) 
    5552                        if ( $thumb_url ) {
    5653                                echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
    5754                        }
    58                         echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
     55                        if ( current_user_can( 'edit_post', $id ) ) {
     56                                echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
     57                        }
     58                        else {
     59                                echo '<span class="edit-attachment">' . _x( 'Success', 'media item' ) . '</span>';
     60                        }
    5961
    6062                        // Title shouldn't ever be empty, but use filename just in case.
    6163                        $file  = get_attached_file( $post->ID );