WordPress.org

Make WordPress Core

Ticket #40916: class-wp-comments-list-table.diff

File class-wp-comments-list-table.diff, 1.1 KB (added by adam3128, 4 years ago)

Conditional check for comment status. If not approved, add noreferrer to anchor tags shown on dashboard.

  • class-wp-comments-list-table.php

     
    676676        public function column_author( $comment ) {
    677677                global $comment_status;
    678678
     679                $the_comment_class = wp_get_comment_status( $comment );
     680
    679681                $author_url = get_comment_author_url( $comment );
    680682
    681683                $author_url_display = untrailingslashit( preg_replace( '|^http(s)?://(www\.)?|i', '', $author_url ) );
     
    685687
    686688                echo "<strong>"; comment_author( $comment ); echo '</strong><br />';
    687689                if ( ! empty( $author_url_display ) ) {
    688                         printf( '<a href="%s">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) );
     690                        if('approved' === $the_comment_class) {
     691                                printf( '<a href="%s">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) );
     692                        } else {
     693                                printf( '<a href="%s" rel="noreferrer">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) );
     694                        }
    689695                }
    690696
    691697                if ( $this->user_can ) {