Make WordPress Core

Changeset 37941


Ignore:
Timestamp:
07/01/2016 03:06:54 PM (8 years ago)
Author:
helen
Message:

Media: Only show parent post titles when the user can read said post.

fixes #37186.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-media-list-table.php

    r37774 r37941  
    477477            $title = _draft_or_post_title( $post->post_parent );
    478478            $parent_type = get_post_type_object( $parent->post_type );
     479           
     480            if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
    479481?>
    480             <strong>
    481             <?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
    482                 <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
    483                     <?php echo $title ?></a><?php
     482                <strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
     483                    <?php echo $title ?></a></strong><?php
     484            } elseif ( current_user_can( 'read_post', $post->post_parent ) ) {
     485?>
     486                <strong><?php echo $title ?></strong><?php
    484487            } else {
    485                 echo $title;
    486             } ?></strong>
    487             <br />
    488             <?php
     488                _e( '(Private post)' );
     489            }
     490
    489491            if ( $user_can_edit ):
    490492                $detach_url = add_query_arg( array(
     
    494496                ), 'upload.php' );
    495497                printf(
    496                     '<a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>',
     498                    '<br /><a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>',
    497499                    $detach_url,
    498500                    /* translators: %s: title of the post the attachment is attached to */
     
    502504            endif;
    503505        } else {
    504             _e( '(Unattached)' ); ?><br />
     506            _e( '(Unattached)' ); ?>
    505507            <?php if ( $user_can_edit ) {
    506508                $title = _draft_or_post_title( $post->post_parent );
    507509                printf(
    508                     '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>',
     510                    '<br /><a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>',
    509511                    $post->ID,
    510512                    /* translators: %s: attachment title */
  • trunk/src/wp-includes/media.php

    r37727 r37941  
    30663066            $response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );
    30673067        }
    3068         $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
     3068
     3069        if ( current_user_can( 'read_post', $attachment->post_parent ) ) {
     3070            $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
     3071        }
    30693072    }
    30703073
Note: See TracChangeset for help on using the changeset viewer.