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
if ( $comment->comment_parent ) :
$parent = get_comment( $comment->comment_parent );
$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(
/* translators: comment link */
__( 'In reply to: %s' ),
'<b><a href="' . $parent_link . '">' . $name . '</a></b>'
); ?>
</div>
<?php endif; ?>
if ( $parent ) :
$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(
/* translators: comment link */
__( 'In reply to: %s' ),
'<b><a href="' . $parent_link . '">' . $name . '</a></b>'
); ?>
</div>
<?php endif;
endif; ?>
<?php
/**

View File

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

View File

@ -4,7 +4,7 @@
*
* @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.