Skip to content

Commit

Permalink
Remove nonce from comment form to prevent issues with caching
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Apr 8, 2014
1 parent 5228e3f commit af70da5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions includes/class-wc-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,8 @@ public function exclude_order_comments_from_feed_where( $where ) {
* @return array
*/
public function check_comment_rating( $comment_data ) {

// If posting a comment (not trackback etc) and not logged in
if ( isset( $_POST['rating'] ) && ! wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-comment_rating' ) )
wp_die( __( 'You have taken too long. Please go back and refresh the page.', 'woocommerce' ) );

elseif ( isset( $_POST['rating'] ) && empty( $_POST['rating'] ) && $comment_data['comment_type'] == '' && get_option('woocommerce_review_rating_required') == 'yes' ) {
if ( isset( $_POST['rating'] ) && empty( $_POST['rating'] ) && $comment_data['comment_type'] === '' && get_option('woocommerce_review_rating_required') === 'yes' ) {
wp_die( __( 'Please rate the product.', 'woocommerce' ) );
exit;
}
Expand Down
2 changes: 1 addition & 1 deletion templates/single-product-reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
</select></p>';
}

$comment_form['comment_field'] .= '<p class="comment-form-comment"><label for="comment">' . __( 'Your Review', 'woocommerce' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>' . wp_nonce_field( 'woocommerce-comment_rating', '_wpnonce', true, false ) . '</p>';
$comment_form['comment_field'] .= '<p class="comment-form-comment"><label for="comment">' . __( 'Your Review', 'woocommerce' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>';

comment_form( apply_filters( 'woocommerce_product_review_comment_form_args', $comment_form ) );
?>
Expand Down

0 comments on commit af70da5

Please sign in to comment.