From 4fe3dd28fb3751aab40969a37fd6f282ff8488e0 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 17 Feb 2014 19:13:01 +0200 Subject: [PATCH] Move email lookup to own endpoint customers/email/ --- includes/api/class-wc-api-customers.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/api/class-wc-api-customers.php b/includes/api/class-wc-api-customers.php index dbfc5c1ad22..ae71ca8b755 100644 --- a/includes/api/class-wc-api-customers.php +++ b/includes/api/class-wc-api-customers.php @@ -71,7 +71,7 @@ class WC_API_Customers extends WC_API_Resource { ); # GET /customers/ - $routes[ $this->base . '/(?P.+)' ] = array( + $routes[ $this->base . '/email/(?P.+)' ] = array( array( array( $this, 'get_customer_by_email' ), WC_API_SERVER::READABLE ), ); @@ -190,7 +190,7 @@ class WC_API_Customers extends WC_API_Resource { * @param string $fields * @return array */ - function get_customer_by_email( $email, $field = null ) { + function get_customer_by_email( $email, $fields = null ) { if ( is_email( $email ) ) { $customer = get_user_by( 'email', $email ); @@ -201,7 +201,7 @@ class WC_API_Customers extends WC_API_Resource { return new WP_Error( 'woocommerce_api_invalid_customer_email', __( 'Invalid customer Email', 'woocommerce' ), array( 'status' => 404 ) ); } - return $this->get_customer( $customer->ID, $field ); + return $this->get_customer( $customer->ID, $fields ); } /**