Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:28:05 PM (3 years ago)
Author:
davidbaumwald
Message:

Grouped backports to the 4.3 branch.

  • Comments: Prevent users who can not see a post from seeing comments on it.
  • Shortcodes: Restrict ajax handler for media shortcode.
  • Prevent unintended behavior when certain objects are unserialized.

Merges [56835], [56836], and [56838] to the 4.1 branch.
Props xknown, jorbin, joehoyle, peterwilsoncc, ehtis, tykoted, antpb.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.3/src/wp-admin/includes/class-wp-list-table.php

    r33623 r56852  
    624624                $pending_phrase = sprintf( _n( '%s pending comment', '%s pending comments', $pending_comments ), $pending_comments_number );
    625625
    626                 // No comments at all.
     626                $post_object   = get_post( $post_id );
     627                $edit_post_cap = $post_object ? 'edit_post' : 'edit_posts';
     628                if (
     629                        current_user_can( $edit_post_cap, $post_id ) ||
     630                        (
     631                                empty( $post_object->post_password ) &&
     632                                current_user_can( 'read_post', $post_id )
     633                        )
     634                ) {
     635                        // The user has access to the post and thus can see comments
     636                } else {
     637                        return false;
     638                }
     639
    627640                if ( ! $approved_comments && ! $pending_comments ) {
    628641                        printf( '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
Note: See TracChangeset for help on using the changeset viewer.