Check isset in check_comment_rating

This commit is contained in:
Mike Jolley 2017-02-24 10:35:28 +00:00
parent 6f02cda453
commit bed9313fab
1 changed files with 2 additions and 9 deletions

View File

@ -182,23 +182,16 @@ class WC_Comments {
/**
* Validate the comment ratings.
*
* @param array $comment_data
* @return array
*/
public static function check_comment_rating( $comment_data ) {
// If posting a comment (not trackback etc) and not logged in
if (
! is_admin()
&& 'product' === get_post_type( $_POST['comment_post_ID'] )
&& empty( $_POST['rating'] )
&& '' === $comment_data['comment_type']
&& 'yes' === get_option( 'woocommerce_enable_review_rating' )
&& 'yes' === get_option( 'woocommerce_review_rating_required' )
) {
if ( ! is_admin() && isset( $_POST['comment_post_ID'], $_POST['rating'], $comment_data['comment_type'] ) && 'product' === get_post_type( $_POST['comment_post_ID'] ) && empty( $_POST['rating'] ) && '' === $comment_data['comment_type'] && 'yes' === get_option( 'woocommerce_enable_review_rating' ) && 'yes' === get_option( 'woocommerce_review_rating_required' ) ) {
wp_die( __( 'Please rate the product.', 'woocommerce' ) );
exit;
}
return $comment_data;
}