[wp-trac] [WordPress Trac] #37048: Unapproved comments show publicly when using custom page parameter

WordPress Trac noreply at wordpress.org
Wed Jun 8 00:58:38 UTC 2016


#37048: Unapproved comments show publicly when using custom page parameter
--------------------------+------------------------------
 Reporter:  smerriman     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Comments      |     Version:  4.4.1
 Severity:  critical      |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by smerriman):

 Perhaps should match the 'default' logic where unapproved comments for the
 current user are included too? Ie something like (sorry, don't have things
 set up to add patches easily myself right now):


 {{{
 $comment_args = array(
         'post_id' => get_the_ID(),
         'orderby' => 'comment_date_gmt',
         'order' => 'ASC',
         'status' => 'approve',
 );

 global $user_ID;
 $commenter = wp_get_current_commenter();
 $comment_author_email = $commenter['comment_author_email'];
 if ( $user_ID ) {
         $comment_args['include_unapproved'] = array( $user_ID );
 } elseif ( ! empty( $comment_author_email ) ) {
         $comment_args['include_unapproved'] = array( $comment_author_email
 );
 }

 $comments = get_comments($comment_args);

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37048#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list