mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53298 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1287,12 +1287,22 @@ add_filter( 'block_type_metadata', '_wp_multiple_block_styles' );
|
||||
function build_comment_query_vars_from_block( $block ) {
|
||||
|
||||
$comment_args = array(
|
||||
'orderby' => 'comment_date_gmt',
|
||||
'order' => 'ASC',
|
||||
'status' => 'approve',
|
||||
'no_found_rows' => false,
|
||||
'orderby' => 'comment_date_gmt',
|
||||
'order' => 'ASC',
|
||||
'status' => 'approve',
|
||||
'no_found_rows' => false,
|
||||
);
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
$comment_args['include_unapproved'] = array( get_current_user_id() );
|
||||
} else {
|
||||
$unapproved_email = wp_get_unapproved_comment_author_email();
|
||||
|
||||
if ( $unapproved_email ) {
|
||||
$comment_args['include_unapproved'] = array( $unapproved_email );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $block->context['postId'] ) ) {
|
||||
$comment_args['post_id'] = (int) $block->context['postId'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user