Make WordPress Core

Changeset 57285


Ignore:
Timestamp:
01/15/2024 05:40:06 PM (8 months ago)
Author:
SergeyBiryukov
Message:

Comments: Use post_password_required() for comment capability checks.

Follow-up to [56836], [57123].

Fixes #59929.

Location:
trunk/src/wp-admin/includes
Files:
3 edited

Legend:

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

    r57123 r57285  
    649649
    650650        if ( ! current_user_can( $edit_post_cap, $comment->comment_post_ID )
    651             && ( ! empty( $post->post_password )
     651            && ( post_password_required( $comment->comment_post_ID )
    652652                || ! current_user_can( 'read_post', $comment->comment_post_ID ) )
    653653        ) {
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r57123 r57285  
    833833
    834834        if ( ! current_user_can( $edit_post_cap, $post_id )
    835             && ( ! empty( $post_object->post_password )
     835            && ( post_password_required( $post_id )
    836836                || ! current_user_can( 'read_post', $post_id ) )
    837837        ) {
  • trunk/src/wp-admin/includes/dashboard.php

    r57123 r57285  
    10891089
    10901090        foreach ( $possible as $comment ) {
    1091             $comment_post = get_post( $comment->comment_post_ID );
    1092 
    10931091            if ( ! current_user_can( 'edit_post', $comment->comment_post_ID )
    1094                 && ( ! empty( $comment_post->post_password )
     1092                && ( post_password_required( $comment->comment_post_ID )
    10951093                    || ! current_user_can( 'read_post', $comment->comment_post_ID ) )
    10961094            ) {
Note: See TracChangeset for help on using the changeset viewer.