From c075eec24f2f3214ab0d0fb0120a23082e6b1122 Mon Sep 17 00:00:00 2001 From: whyisjake Date: Wed, 10 Jun 2020 19:20:11 +0000 Subject: [PATCH] Editor: Ensure latest comments can only be viewed from public posts. Props: poena, xknown. Built from https://develop.svn.wordpress.org/trunk@47984 git-svn-id: http://core.svn.wordpress.org/trunk@47752 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 9 +++++++-- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 104293b1bc..453a9ae5bf 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -596,8 +596,13 @@ function comment_date( $format = '', $comment_ID = 0 ) { * @return string The possibly truncated comment excerpt. */ function get_comment_excerpt( $comment_ID = 0 ) { - $comment = get_comment( $comment_ID ); - $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) ); + $comment = get_comment( $comment_ID ); + + if ( ! post_password_required( $comment->comment_post_ID ) ) { + $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) ); + } else { + $comment_text = __( 'Password protected' ); + } /* translators: Maximum number of words used in a comment excerpt. */ $comment_excerpt_length = intval( _x( '20', 'comment_excerpt_length' ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index ade54e7178..fc5a1d86d0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47952'; +$wp_version = '5.5-alpha-47984'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.