When ratings are required for reviews, ensure validation is performed if the rating element is removed from DOM.
Closes #7371
This commit is contained in:
parent
bce209c21d
commit
1f9b9c0ae0
|
@ -180,7 +180,7 @@ class WC_Comments {
|
|||
*/
|
||||
public static function check_comment_rating( $comment_data ) {
|
||||
// If posting a comment (not trackback etc) and not logged in
|
||||
if ( isset( $_POST['rating'] ) && empty( $_POST['rating'] ) && '' === $comment_data['comment_type'] && 'yes' === get_option( 'woocommerce_review_rating_required' ) ) {
|
||||
if ( 'product' === get_post_type( $_POST['comment_post_ID'] ) && empty( $_POST['rating'] ) && '' === $comment_data['comment_type'] && 'yes' === get_option( 'woocommerce_review_rating_required' ) ) {
|
||||
wp_die( __( 'Please rate the product.', 'woocommerce' ) );
|
||||
exit;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class WC_Comments {
|
|||
* @param int $comment_id
|
||||
*/
|
||||
public static function add_comment_rating( $comment_id ) {
|
||||
if ( isset( $_POST['rating'] ) ) {
|
||||
if ( isset( $_POST['rating'] ) && 'product' === get_post_type( $_POST['comment_post_ID'] ) ) {
|
||||
if ( ! $_POST['rating'] || $_POST['rating'] > 5 || $_POST['rating'] < 0 ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Fix - Item meta removal query in order class.
|
||||
* Fix - Pass correct shipping cost to PayPal.
|
||||
* Fix - Flat rate extra costs when costs are an array.
|
||||
* Fix - When ratings are required for reviews, ensure validation is performed if the rating element is removed from DOM.
|
||||
|
||||
= 2.3.1 - 11/02/2015 =
|
||||
* Fix - When the geolocation database cannot download, ensure the correct method is used to log the error.
|
||||
|
|
Loading…
Reference in New Issue