Add isset() check to avoid notice. Props c3mdigital. fixes #21512

git-svn-id: http://core.svn.wordpress.org/trunk@21506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-08-14 19:07:56 +00:00
parent a84e9aebfd
commit dc58551658
1 changed files with 1 additions and 1 deletions

View File

@ -655,7 +655,7 @@ function wp_allow_comment($commentdata) {
$post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID));
}
if ( $user && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
if ( isset( $user ) && ( $user_id == $post_author || $user->has_cap( 'moderate_comments' ) ) ) {
// The author and the admins get respect.
$approved = 1;
} else {