Make WordPress Core

Ticket #33710: 33710.diff

File 33710.diff, 4.2 KB (added by wonderboymusic, 10 years ago)
  • src/wp-admin/includes/dashboard.php

     
    556556function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
    557557        $GLOBALS['comment'] =& $comment;
    558558
    559         $comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
    560 
    561         if ( current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
     559        if ( $comment->comment_post_ID > 0 && current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
     560                $comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
    562561                $comment_post_url = get_edit_post_link( $comment->comment_post_ID );
    563562                $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
    564563        } else {
    565                 $comment_post_link = $comment_post_title;
     564                $comment_post_link = '';
    566565        }
    567566
    568567        $actions_string = '';
     
    599598                }
    600599
    601600                if ( '1' === $comment->comment_approved ) {
    602                         $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link() ) . '">' . _x( 'View', 'verb' ) . '</a>';
     601                        $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . _x( 'View', 'verb' ) . '</a>';
    603602                }
    604603
    605604                /**
     
    630629
    631630?>
    632631
    633                 <div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status($comment->comment_ID) ) ); ?>>
     632                <div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ) ); ?>>
    634633
    635634                        <?php echo get_avatar( $comment, 50, 'mystery' ); ?>
    636635
     
    638637
    639638                        <div class="dashboard-comment-wrap has-row-actions">
    640639                        <h4 class="comment-meta">
    641                                 <?php printf( /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */__( 'From %1$s on %2$s%3$s' ),
    642                                         '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?>
     640                                <?php
     641                                if ( $comment_post_link ) {
     642                                        printf(
     643                                                /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */
     644                                                __( 'From %1$s on %2$s%3$s' ),
     645                                                '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
     646                                                $comment_post_link,
     647                                                ' <span class="approve">' . __( '[Pending]' ) . '</span>'
     648                                        );
     649                                } else {
     650                                        printf(
     651                                                /* translators: 1: comment author, 2: notification if the comment is pending */
     652                                                __( 'From %1$s %2$s' ),
     653                                                '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
     654                                                ' <span class="approve">' . __( '[Pending]' ) . '</span>'
     655                                        );
     656                                }
     657                                ?>
    643658                        </h4>
    644659
    645660                        <?php
     
    659674                        <div class="dashboard-comment-wrap has-row-actions">
    660675                        <?php /* translators: %1$s is type of comment, %2$s is link to the post */ ?>
    661676                        <h4 class="comment-meta"><?php printf( _x( '%1$s on %2$s', 'dashboard' ), "<strong>$type</strong>", $comment_post_link ); ?></h4>
    662                         <p class="comment-author"><?php comment_author_link(); ?></p>
     677                        <p class="comment-author"><?php comment_author_link( $comment ); ?></p>
    663678
    664679                        <?php endif; // comment_type ?>
    665                         <blockquote><p><?php comment_excerpt(); ?></p></blockquote>
     680                        <blockquote><p><?php comment_excerpt( $comment ); ?></p></blockquote>
    666681                        <p class="row-actions"><?php echo $actions_string; ?></p>
    667682                        </div>
    668683                </div>
    669684<?php
     685        $GLOBALS['comment'] = null;
    670686}
    671687
    672688/**
  • src/wp-includes/pluggable.php

     
    13621362        }
    13631363
    13641364        $comment = get_comment( $comment_id );
    1365         if ( empty( $comment ) )
     1365        if ( empty( $comment ) || empty( $comment->comment_post_ID ) )
    13661366                return false;
    13671367
    13681368        $post    = get_post( $comment->comment_post_ID );
     
    18211821         * @param string|int $action The nonce action.
    18221822         * @param WP_User    $user   The current user object.
    18231823         * @param string     $token  The user's session token.
    1824          */ 
     1824         */
    18251825        do_action( 'wp_verify_nonce_failed', $nonce, $action, $user, $token );
    18261826
    18271827        // Invalid nonce