WordPress.org

Make WordPress Core

Changeset 36521


Ignore:
Timestamp:
02/12/2016 09:42:03 PM (4 years ago)
Author:
rachelbaker
Message:

Comments: In the comments list table, only link rows inside the “Submitted On” column to the comment if it is publicly viewable.

The date within the comments list table “Submitted On” column will only be wrapped in get_comment_link() if the comment is approved and associated with a valid comment_post_ID.

Fixes #35279.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r36480 r36521  
    717717     */
    718718    public function column_date( $comment ) {
    719         echo '<div class="submitted-on">';
    720         echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">';
    721719        /* translators: 1: comment date, 2: comment time */
    722         printf( __( '%1$s at %2$s' ),
     720        $submitted = sprintf( __( '%1$s at %2$s' ),
    723721            /* translators: comment date format. See http://php.net/date */
    724722            get_comment_date( __( 'Y/m/d' ), $comment ),
    725723            get_comment_date( __( 'g:i a' ), $comment )
    726724        );
    727         echo '</a>';
     725
     726        echo '<div class="submitted-on">';
     727        if ( 'approved' === wp_get_comment_status( $comment ) && ! empty ( $comment->comment_post_ID ) ) {
     728            printf(
     729                '<a href="%s">%s</a>',
     730                esc_url( get_comment_link( $comment ) ),
     731                $submitted
     732            );
     733        } else {
     734            echo $submitted;
     735        }
    728736        echo '</div>';
    729737    }
Note: See TracChangeset for help on using the changeset viewer.