diff --git a/includes/admin/reports/class-wc-report-customer-list.php b/includes/admin/reports/class-wc-report-customer-list.php index ae016e905ae..d7be5f4a561 100644 --- a/includes/admin/reports/class-wc-report-customer-list.php +++ b/includes/admin/reports/class-wc-report-customer-list.php @@ -41,7 +41,7 @@ class WC_Report_Customer_List extends WP_List_Table { echo '
'; if ( ! empty( $_GET['link_orders'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'link_orders' ) ) { - $linked = woocommerce_update_new_customer_past_orders( absint( $_GET['link_orders'] ) ); + $linked = wc_update_new_customer_past_orders( absint( $_GET['link_orders'] ) ); echo '

' . sprintf( _n( '%s previous order linked', '%s previous orders linked', $linked, 'woocommerce' ), $linked ) . '

'; } diff --git a/includes/api/class-wc-api-products.php b/includes/api/class-wc-api-products.php index 37b93d250c8..78fb07aed23 100644 --- a/includes/api/class-wc-api-products.php +++ b/includes/api/class-wc-api-products.php @@ -213,7 +213,7 @@ class WC_API_Products extends WC_API_Resource { 'rating' => get_comment_meta( $comment->comment_ID, 'rating', true ), 'reviewer_name' => $comment->comment_author, 'reviewer_email' => $comment->comment_author_email, - 'verified' => (bool) woocommerce_customer_bought_product( $comment->comment_author_email, $comment->user_id, $id ), + 'verified' => (bool) wc_customer_bought_product( $comment->comment_author_email, $comment->user_id, $id ), ); } diff --git a/includes/class-wc-checkout.php b/includes/class-wc-checkout.php index ae31f34d844..f0090765054 100644 --- a/includes/class-wc-checkout.php +++ b/includes/class-wc-checkout.php @@ -614,14 +614,14 @@ class WC_Checkout { $username = ! empty( $this->posted['account_username'] ) ? $this->posted['account_username'] : ''; $password = ! empty( $this->posted['account_password'] ) ? $this->posted['account_password'] : ''; - $new_customer = woocommerce_create_new_customer( $this->posted['billing_email'], $username, $password ); + $new_customer = wc_create_new_customer( $this->posted['billing_email'], $username, $password ); if ( is_wp_error( $new_customer ) ) throw new Exception( $new_customer->get_error_message() ); $this->customer_id = $new_customer; - woocommerce_set_customer_auth_cookie( $this->customer_id ); + wc_set_customer_auth_cookie( $this->customer_id ); // As we are now logged in, checkout will need to refresh to show logged in data WC()->session->set( 'reload_checkout', true ); diff --git a/includes/class-wc-form-handler.php b/includes/class-wc-form-handler.php index 63468c2f9d7..04438835d33 100644 --- a/includes/class-wc-form-handler.php +++ b/includes/class-wc-form-handler.php @@ -798,14 +798,14 @@ class WC_Form_Handler { return; } - $new_customer = woocommerce_create_new_customer( $email, $username, $password ); + $new_customer = wc_create_new_customer( $email, $username, $password ); if ( is_wp_error( $new_customer ) ) { wc_add_notice( $new_customer->get_error_message(), 'error' ); return; } - woocommerce_set_customer_auth_cookie( $new_customer ); + wc_set_customer_auth_cookie( $new_customer ); // Redirect if ( wp_get_referer() ) { diff --git a/includes/wc-customer-functions.php b/includes/wc-customer-functions.php index c3f2835405d..35664c8d2dc 100644 --- a/includes/wc-customer-functions.php +++ b/includes/wc-customer-functions.php @@ -21,14 +21,14 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly * @param bool $show_admin_bar * @return bool */ -function woocommerce_disable_admin_bar( $show_admin_bar ) { +function wc_disable_admin_bar( $show_admin_bar ) { if ( apply_filters( 'woocommerce_disable_admin_bar', get_option( 'woocommerce_lock_down_admin', "yes" ) == "yes" ) && ! ( current_user_can('edit_posts') || current_user_can('manage_woocommerce') ) ) { $show_admin_bar = false; } return $show_admin_bar; } -add_filter( 'show_admin_bar', 'woocommerce_disable_admin_bar', 10, 1 ); +add_filter( 'show_admin_bar', 'wc_disable_admin_bar', 10, 1 ); /** @@ -39,7 +39,7 @@ add_filter( 'show_admin_bar', 'woocommerce_disable_admin_bar', 10, 1 ); * @param string $password * @return WP_Error on failure, Int (user ID) on success */ -function woocommerce_create_new_customer( $email, $username = '', $password = '' ) { +function wc_create_new_customer( $email, $username = '', $password = '' ) { // Check the e-mail address if ( empty( $email ) || ! is_email( $email ) ) @@ -117,7 +117,7 @@ function woocommerce_create_new_customer( $email, $username = '', $password = '' * @param int $customer_id * @return void */ -function woocommerce_set_customer_auth_cookie( $customer_id ) { +function wc_set_customer_auth_cookie( $customer_id ) { global $current_user; $current_user = get_user_by( 'id', $customer_id ); @@ -131,7 +131,7 @@ function woocommerce_set_customer_auth_cookie( $customer_id ) { * @param int $customer_id * @return void */ -function woocommerce_update_new_customer_past_orders( $customer_id ) { +function wc_update_new_customer_past_orders( $customer_id ) { $customer = get_user_by( 'id', absint( $customer_id ) ); @@ -189,7 +189,7 @@ function woocommerce_update_new_customer_past_orders( $customer_id ) { * @param int $order_id * @return void */ -function woocommerce_paying_customer( $order_id ) { +function wc_paying_customer( $order_id ) { $order = new WC_Order( $order_id ); @@ -203,12 +203,10 @@ function woocommerce_paying_customer( $order_id ) { update_user_meta( $order->user_id, '_order_count', $old_count + 1 ); } } -add_action( 'woocommerce_order_status_completed', 'woocommerce_paying_customer' ); +add_action( 'woocommerce_order_status_completed', 'wc_paying_customer' ); /** - * woocommerce_customer_bought_product - * * Checks if a user (by email) has bought an item * * @access public @@ -217,7 +215,7 @@ add_action( 'woocommerce_order_status_completed', 'woocommerce_paying_customer' * @param int $product_id * @return bool */ -function woocommerce_customer_bought_product( $customer_email, $user_id, $product_id ) { +function wc_customer_bought_product( $customer_email, $user_id, $product_id ) { global $wpdb; $emails = array(); @@ -261,8 +259,6 @@ function woocommerce_customer_bought_product( $customer_email, $user_id, $produc } /** - * woocommerce_customer_has_capability - * * Checks if a user has a certain capability * * @access public @@ -271,7 +267,7 @@ function woocommerce_customer_bought_product( $customer_email, $user_id, $produc * @param array $args * @return bool */ -function woocommerce_customer_has_capability( $allcaps, $caps, $args ) { +function wc_customer_has_capability( $allcaps, $caps, $args ) { if ( isset( $caps[0] ) ) { switch ( $caps[0] ) { @@ -323,4 +319,4 @@ function woocommerce_customer_has_capability( $allcaps, $caps, $args ) { } return $allcaps; } -add_filter( 'user_has_cap', 'woocommerce_customer_has_capability', 10, 3); \ No newline at end of file +add_filter( 'user_has_cap', 'wc_customer_has_capability', 10, 3); \ No newline at end of file diff --git a/includes/wc-deprecated-functions.php b/includes/wc-deprecated-functions.php index 834eec2f07c..c8118bc7528 100644 --- a/includes/wc-deprecated-functions.php +++ b/includes/wc-deprecated-functions.php @@ -115,6 +115,31 @@ function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: te wc_mail( $to, $subject, $message, $headers, $attachments ); } +/** + * Customer functions (soft deprecated) + */ +function woocommerce_disable_admin_bar( $show_admin_bar ) { + wc_disable_admin_bar( $show_admin_bar ); +} +function woocommerce_create_new_customer( $email, $username = '', $password = '' ) { + wc_create_new_customer( $email, $username, $password ); +} +function woocommerce_set_customer_auth_cookie( $customer_id ) { + wc_set_customer_auth_cookie( $customer_id ); +} +function woocommerce_update_new_customer_past_orders( $customer_id ) { + wc_update_new_customer_past_orders( $customer_id ); +} +function wc_paying_customer( $order_id ) { + woocommerce_paying_customer( $order_id ); +} +function woocommerce_customer_bought_product( $customer_email, $user_id, $product_id ) { + wc_customer_bought_product( $customer_email, $user_id, $product_id ); +} +function woocommerce_customer_has_capability( $allcaps, $caps, $args ) { + wc_customer_has_capability( $allcaps, $caps, $args ); +} + /** * Handle renamed filters */ diff --git a/templates/single-product-reviews.php b/templates/single-product-reviews.php index 6ee870f0918..5ea0857b8d7 100644 --- a/templates/single-product-reviews.php +++ b/templates/single-product-reviews.php @@ -43,7 +43,7 @@ if ( ! comments_open() )
- id ) ) : ?> + id ) ) : ?>
diff --git a/templates/single-product/review.php b/templates/single-product/review.php index 69c2021fccc..722ccbf2350 100644 --- a/templates/single-product/review.php +++ b/templates/single-product/review.php @@ -39,7 +39,7 @@ $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) ); comment_author_email, $comment->user_id, $comment->comment_post_ID ) ) + if ( wc_customer_bought_product( $comment->comment_author_email, $comment->user_id, $comment->comment_post_ID ) ) echo '(' . __( 'verified owner', 'woocommerce' ) . ') '; ?>– :