Make WordPress Core


Ignore:
Timestamp:
04/28/2022 01:16:18 AM (2 years ago)
Author:
peterwilsoncc
Message:

Editor: Show comment previews in the Comment Query Loop.

Update build_comment_query_vars_from_block() to show previews of unmoderated comments to the original author of the comment. This duplicates the existing logic in wp_list_comments().

Props darerodz, bernhard-reiter, czapla.
Fixes #55634.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r53235 r53298  
    12881288
    12891289    $comment_args = array(
    1290         'orderby'                   => 'comment_date_gmt',
    1291         'order'                     => 'ASC',
    1292         'status'                    => 'approve',
    1293         'no_found_rows'             => false,
    1294     );
     1290        'orderby'       => 'comment_date_gmt',
     1291        'order'         => 'ASC',
     1292        'status'        => 'approve',
     1293        'no_found_rows' => false,
     1294    );
     1295
     1296    if ( is_user_logged_in() ) {
     1297        $comment_args['include_unapproved'] = array( get_current_user_id() );
     1298    } else {
     1299        $unapproved_email = wp_get_unapproved_comment_author_email();
     1300
     1301        if ( $unapproved_email ) {
     1302            $comment_args['include_unapproved'] = array( $unapproved_email );
     1303        }
     1304    }
    12951305
    12961306    if ( ! empty( $block->context['postId'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.