Make WordPress Core


Ignore:
Timestamp:
06/10/2020 07:18:50 PM (4 years ago)
Author:
whyisjake
Message:

Editor: Ensure latest comments can only be viewed from public posts.

Props: poena, xknown.

File:
1 edited

Legend:

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

    r47889 r47984  
    597597 */
    598598function get_comment_excerpt( $comment_ID = 0 ) {
    599     $comment      = get_comment( $comment_ID );
    600     $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) );
     599    $comment = get_comment( $comment_ID );
     600
     601    if ( ! post_password_required( $comment->comment_post_ID ) ) {
     602        $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) );
     603    } else {
     604        $comment_text = __( 'Password protected' );
     605    }
    601606
    602607    /* translators: Maximum number of words used in a comment excerpt. */
Note: See TracChangeset for help on using the changeset viewer.