Comments/PHP Notices: check that a parent comment exists before displaying an orphan's link to it in the admin.

Props rachelbaker.
Fixes #33710.

Built from https://develop.svn.wordpress.org/trunk@34015


git-svn-id: http://core.svn.wordpress.org/trunk@33984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-10 20:51:23 +00:00
parent a5529285d1
commit 98acab10ea
3 changed files with 19 additions and 15 deletions

View File

@ -119,17 +119,19 @@ if ( current_user_can( 'edit_post', $post_id ) ) {
<?php <?php
if ( $comment->comment_parent ) : if ( $comment->comment_parent ) :
$parent = get_comment( $comment->comment_parent ); $parent = get_comment( $comment->comment_parent );
$parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); if ( $parent ) :
$name = get_comment_author( $parent->comment_ID ); $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
?> $name = get_comment_author( $parent->comment_ID );
<div class="misc-pub-section misc-pub-reply-to"> ?>
<?php printf( <div class="misc-pub-section misc-pub-reply-to">
/* translators: comment link */ <?php printf(
__( 'In reply to: %s' ), /* translators: comment link */
'<b><a href="' . $parent_link . '">' . $name . '</a></b>' __( 'In reply to: %s' ),
); ?> '<b><a href="' . $parent_link . '">' . $name . '</a></b>'
</div> ); ?>
<?php endif; ?> </div>
<?php endif;
endif; ?>
<?php <?php
/** /**

View File

@ -607,9 +607,11 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( $comment->comment_parent ) { if ( $comment->comment_parent ) {
$parent = get_comment( $comment->comment_parent ); $parent = get_comment( $comment->comment_parent );
$parent_link = esc_url( get_comment_link( $parent ) ); if ( $parent ) {
$name = get_comment_author( $parent ); $parent_link = esc_url( get_comment_link( $parent ) );
printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name ); $name = get_comment_author( $parent );
printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
}
} }
echo '</div>'; echo '</div>';

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34014'; $wp_version = '4.4-alpha-34015';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.