diff --git a/includes/admin/settings/class-wc-settings-products.php b/includes/admin/settings/class-wc-settings-products.php index 41ce8c9679bbc..6e4f6a52f16ee 100644 --- a/includes/admin/settings/class-wc-settings-products.php +++ b/includes/admin/settings/class-wc-settings-products.php @@ -343,6 +343,16 @@ public function get_settings( $current_section = '' ) { 'id' => 'woocommerce_review_rating_verification_label', 'default' => 'yes', 'type' => 'checkbox', + 'checkboxgroup' => '', + 'show_if_checked' => 'yes', + 'autoload' => false + ), + + array( + 'desc' => __( 'Only allow reviews from "verified owners"', 'woocommerce' ), + 'id' => 'woocommerce_review_rating_verification_required', + 'default' => 'no', + 'type' => 'checkbox', 'checkboxgroup' => 'end', 'show_if_checked' => 'yes', 'autoload' => false diff --git a/includes/wc-customer-functions.php b/includes/wc-customer-functions.php index 1cf69087849c3..c3f2835405d75 100644 --- a/includes/wc-customer-functions.php +++ b/includes/wc-customer-functions.php @@ -233,7 +233,8 @@ function woocommerce_customer_bought_product( $customer_email, $user_id, $produc if ( sizeof( $emails ) == 0 ) return false; - $completed = get_term_by( 'slug', 'completed', 'shop_order_status' ); + $completed = get_term_by( 'slug', 'completed', 'shop_order_status' ); + $processing = get_term_by( 'slug', 'processing', 'shop_order_status' ); return $wpdb->get_var( $wpdb->prepare( " @@ -243,18 +244,18 @@ function woocommerce_customer_bought_product( $customer_email, $user_id, $produc LEFT JOIN {$wpdb->postmeta} AS postmeta ON order_items.order_id = postmeta.post_id LEFT JOIN {$wpdb->term_relationships} AS rel ON order_items.order_id = rel.object_ID WHERE - rel.term_taxonomy_id = %d AND + rel.term_taxonomy_id IN ( %d, %d ) AND itemmeta.meta_value = %s AND itemmeta.meta_key IN ( '_variation_id', '_product_id' ) AND postmeta.meta_key IN ( '_billing_email', '_customer_user' ) AND ( postmeta.meta_value IN ( '" . implode( "','", array_unique( $emails ) ) . "' ) OR ( - postmeta.meta_value = %d AND + postmeta.meta_value = %s AND postmeta.meta_value > 0 ) ) - ", $completed->term_taxonomy_id, $product_id, $user_id + ", $completed->term_taxonomy_id, $processing->term_taxonomy_id, $product_id, $user_id ) ); } diff --git a/readme.txt b/readme.txt index 94186ae35f678..a4411982b03db 100644 --- a/readme.txt +++ b/readme.txt @@ -186,6 +186,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc * Feature - WC_DELIMITER to customise the pipes for attributes * Feature - Standardized, default credit card form for gateways to use if they support 'default_credit_card_form'. * Feature - Coupon usage limits per user (using email + ID). +* Feature - Option to limit reviews to purchasers. * Tweak - Added pagination to tax rate screens. * Tweak - Added filter to check the 'Create account' checkbox on checkout by default. * Tweak - Update CPT parameters for 'product_variation' and 'shop_coupon' to be no longer public. diff --git a/templates/single-product-reviews.php b/templates/single-product-reviews.php index 6c535de28438a..6ee870f091895 100644 --- a/templates/single-product-reviews.php +++ b/templates/single-product-reviews.php @@ -4,92 +4,91 @@ * * @author WooThemes * @package WooCommerce/Templates - * @version 2.0.3 + * @version 2.1.0 */ global $woocommerce, $product; -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly +if ( ! defined( 'ABSPATH' ) ) + exit; // Exit if accessed directly +if ( ! comments_open() ) + return; ?> -
'; - - if ( get_option('woocommerce_enable_review_rating') == 'yes' && ( $count = $product->get_rating_count() ) ) { - - echo '

' . sprintf( _n('%s review for %s', '%s reviews for %s', $count, 'woocommerce'), $count, get_the_title() ) . '

'; - - } else { - - echo '

'.__( 'Reviews', 'woocommerce' ).'

'; - - } - - $title_reply = ''; - - if ( have_comments() ) : - - echo '
    '; - - wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ) ); - - echo '
'; - - if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> - - \ No newline at end of file +
+
\ No newline at end of file