WordPress.org

Make WordPress Core

Ticket #21512: 21512.patch

File 21512.patch, 605 bytes (added by c3mdigital, 21 months ago)
  • wp-includes/comment.php

     
    655655                $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID)); 
    656656        } 
    657657 
    658         if ( $user && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) { 
     658        if ( isset( $user ) && ( $user_id == $post_author || $user->has_cap( 'moderate_comments' ) ) ) { 
    659659                // The author and the admins get respect. 
    660660                $approved = 1; 
    661661         } else {