WordPress.org

Make WordPress Core

Ticket #37826: 37826.diff

File 37826.diff, 4.4 KB (added by johnbillion, 18 months ago)
  • src/wp-admin/comment.php

    diff --git a/src/wp-admin/comment.php b/src/wp-admin/comment.php
    index 3f20c3cc2e..627006eefe 100644
    a b if ( isset( $_GET['dt'] ) ) { 
    3636        }
    3737}
    3838
     39// Prevent actions on a comment associated with a trashed post.
     40$comment_id = absint( $_GET['c'] );
     41$comment = get_comment( $comment_id );
     42
     43if ( 'trash' === get_post_status( $comment->comment_post_ID ) ) {
     44        wp_die(
     45                __( 'You can’t edit this comment because the associated post is in the Trash. Please restore the post first, then try again.' )
     46        );
     47}
     48
    3949switch ( $action ) {
    4050
    4151        case 'editcomment':
    switch ( $action ) { 
    6070                wp_enqueue_script( 'comment' );
    6171                require_once ABSPATH . 'wp-admin/admin-header.php';
    6272
    63                 $comment_id = absint( $_GET['c'] );
    64 
    65                 $comment = get_comment( $comment_id );
    6673                if ( ! $comment ) {
    6774                        comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'javascript:history.go(-1)' ) );
    6875                }
    switch ( $action ) { 
    8794        case 'spam':
    8895                $title = __( 'Moderate Comment' );
    8996
    90                 $comment_id = absint( $_GET['c'] );
    91 
    92                 $comment = get_comment( $comment_id );
    9397                if ( ! $comment ) {
    9498                        wp_redirect( admin_url( 'edit-comments.php?error=1' ) );
    9599                        die();
  • src/wp-admin/css/list-tables.css

    diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css
    index 3e55bb2d0e..d7c50535bb 100644
    a b  
    8282        border-right: 5px solid transparent;
    8383}
    8484
    85 .column-response .post-com-count-approved:hover .comment-count-approved,
    86 .column-response .post-com-count-approved:focus .comment-count-approved,
    87 .column-comments .post-com-count-approved:hover .comment-count-approved,
    88 .column-comments .post-com-count-approved:focus .comment-count-approved {
     85.column-response a.post-com-count-approved:hover .comment-count-approved,
     86.column-response a.post-com-count-approved:focus .comment-count-approved,
     87.column-comments a.post-com-count-approved:hover .comment-count-approved,
     88.column-comments a.post-com-count-approved:focus .comment-count-approved {
    8989        background: #0073aa;
    9090}
    9191
    92 .column-response .post-com-count-approved:hover:after,
    93 .column-response .post-com-count-approved:focus:after,
    94 .column-comments .post-com-count-approved:hover:after,
    95 .column-comments .post-com-count-approved:focus:after {
     92.column-response a.post-com-count-approved:hover:after,
     93.column-response a.post-com-count-approved:focus:after,
     94.column-comments a.post-com-count-approved:hover:after,
     95.column-comments a.post-com-count-approved:focus:after {
    9696        border-top-color: #0073aa;
    9797}
    9898
  • src/wp-admin/includes/class-wp-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php
    index c423eebbca..ce23640270 100644
    a b class WP_List_Table { 
    682682                        $pending_comments_number
    683683                );
    684684
    685                 // No comments at all.
    686685                if ( ! $approved_comments && ! $pending_comments ) {
     686                        // No comments at all.
    687687                        printf(
    688688                                '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
    689689                                __( 'No comments' )
    690690                        );
    691                         // Approved comments have different display depending on some conditions.
     691                } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) {
     692                        // Don't link the comment bubble for a trashed post.
     693                        printf(
     694                                '<span class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
     695                                $approved_comments_number,
     696                                $pending_comments ? $approved_phrase : $approved_only_phrase
     697                        );
    692698                } elseif ( $approved_comments ) {
     699                        // Link the comment bubble to approved comments.
    693700                        printf(
    694701                                '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
    695702                                esc_url(
    class WP_List_Table { 
    705712                                $pending_comments ? $approved_phrase : $approved_only_phrase
    706713                        );
    707714                } else {
     715                        // Don't link the comment bubble when there are no approved comments.
    708716                        printf(
    709717                                '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
    710718                                $approved_comments_number,