Make WordPress Core


Ignore:
Timestamp:
10/12/2023 02:21:47 PM (21 months ago)
Author:
davidbaumwald
Message:

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

    r33375 r56850  
    779779
    780780        echo '<div id="the-comment-list" data-wp-lists="list:comment">';
    781         foreach ( $comments as $comment )
    782             _wp_dashboard_recent_comments_row( $comment );
     781        foreach ( $comments as $comment ) {
     782            $comment_post = get_post( $comment->comment_post_ID );
     783            if (
     784                current_user_can( 'edit_post', $comment->comment_post_ID ) ||
     785                (
     786                    empty( $comment_post->post_password ) &&
     787                    current_user_can( 'read_post', $comment->comment_post_ID )
     788                )
     789            ) {
     790                _wp_dashboard_recent_comments_row( $comment );
     791            }
     792        }
    783793        echo '</div>';
    784794
Note: See TracChangeset for help on using the changeset viewer.