Make WordPress Core


Ignore:
Timestamp:
08/13/2015 10:30:26 PM (9 years ago)
Author:
ocean90
Message:

Capabilities: Fall back to the edit_posts capability for orphaned comments.

Also avoid PHP notices because of orphaned comments in the comments list table.
Includes unit test.

props pento, dd32.
fixes #33154.

File:
1 edited

Legend:

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

    r33490 r33614  
    473473        }
    474474
    475         $post = get_post();
    476 
    477475        $the_comment_status = wp_get_comment_status( $comment->comment_ID );
    478476
     
    535533            $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>';
    536534
    537             $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline',esc_attr__( 'Edit this item inline' ), __( 'Quick&nbsp;Edit' ) );
    538 
    539             $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
     535            $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'edit', 'vim-q comment-inline',esc_attr__( 'Edit this item inline' ), __( 'Quick&nbsp;Edit' ) );
     536
     537            $actions['reply'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
    540538        }
    541539
     
    673671        $post = get_post();
    674672
     673        if ( ! $post ) {
     674            return;
     675        }
     676
    675677        if ( isset( $this->pending_count[$post->ID] ) ) {
    676678            $pending_comments = $this->pending_count[$post->ID];
Note: See TracChangeset for help on using the changeset viewer.