Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:25:18 PM (2 years ago)
Author:
davidbaumwald
Message:

Grouped backports to the 4.2 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.2/src/wp-admin/includes/dashboard.php

    r33358 r56851  
    787787
    788788        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
    789         foreach ( $comments as $comment )
    790             _wp_dashboard_recent_comments_row( $comment );
     789        foreach ( $comments as $comment ) {
     790            $comment_post = get_post( $comment->comment_post_ID );
     791            if (
     792                current_user_can( 'edit_post', $comment->comment_post_ID ) ||
     793                (
     794                    empty( $comment_post->post_password ) &&
     795                    current_user_can( 'read_post', $comment->comment_post_ID )
     796                )
     797            ) {
     798                _wp_dashboard_recent_comments_row( $comment );
     799            }
     800        }
    791801        echo '</div>';
    792802
Note: See TracChangeset for help on using the changeset viewer.