Merge pull request #14254 from woocommerce/add/filter-update-customer

woocommerce_update_customer_args filter
This commit is contained in:
Claudio Sanches 2017-04-11 13:45:37 -03:00 committed by GitHub
commit b3fe358168
1 changed files with 4 additions and 4 deletions

View File

@ -101,11 +101,11 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
$customer->set_id( $id );
$this->update_user_meta( $customer );
wp_update_user( array(
wp_update_user( apply_filters( 'woocommerce_update_customer_args', array(
'ID' => $customer->get_id(),
'role' => $customer->get_role(),
'display_name' => $customer->get_first_name() . ' ' . $customer->get_last_name(),
) );
), $customer ) );
$wp_user = new WP_User( $customer->get_id() );
$customer->set_date_created( $wp_user->user_registered );
$customer->set_date_modified( get_user_meta( $customer->get_id(), 'last_update', true ) );
@ -158,11 +158,11 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
* @param WC_Customer
*/
public function update( &$customer ) {
wp_update_user( array(
wp_update_user( apply_filters( 'woocommerce_update_customer_args', array(
'ID' => $customer->get_id(),
'user_email' => $customer->get_email(),
'display_name' => $customer->get_first_name() . ' ' . $customer->get_last_name(),
) );
), $customer ) );
// Only update password if a new one was set with set_password.
if ( $customer->get_password() ) {
wp_update_user( array( 'ID' => $customer->get_id(), 'user_pass' => $customer->get_password() ) );