Check isset in check_comment_rating
This commit is contained in:
parent
6f02cda453
commit
bed9313fab
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue