WC_POS_Customers

POS Customers.

Defined (1)

The class is defined in the following location(s).

/includes/class-wc-pos-customers.php  
  1. class WC_POS_Customers { 
  2.  
  3. // whitelist of usermeta which triggers _user_modified_gmt update 
  4. private $usermeta = array( 
  5. // wp data 
  6. 'first_name',  
  7. 'last_name',  
  8. 'nickname',  
  9.  
  10. // woo order data 
  11. '_order_count',  
  12. '_money_spent',  
  13.  
  14. // woo customer data 
  15. 'billing_first_name',  
  16. 'billing_last_name',  
  17. 'billing_company',  
  18. 'billing_email',  
  19. 'billing_phone',  
  20. 'billing_address_1',  
  21. 'billing_address_2',  
  22. 'billing_city',  
  23. 'billing_state',  
  24. 'billing_postcode',  
  25. 'billing_country',  
  26.  
  27. 'shipping_first_name',  
  28. 'shipping_last_name',  
  29. 'shipping_company',  
  30. 'shipping_address_1',  
  31. 'shipping_address_2',  
  32. 'shipping_city',  
  33. 'shipping_state',  
  34. 'shipping_postcode',  
  35. 'shipping_country',  
  36. ); 
  37.  
  38. public function __construct() { 
  39. add_action( 'profile_update', array( $this, 'profile_update' ) ); 
  40. add_action( 'updated_user_meta', array( $this, 'updated_user_meta' ), 10, 4); 
  41.  
  42. /** 
  43. * WP Users has not modified date 
  44. * POS needs to track which customer profiles have been updated 
  45. * @param $id 
  46. */ 
  47. public function profile_update($id) { 
  48. update_user_meta($id, '_user_modified_gmt', current_time( 'mysql', 1 )); 
  49.  
  50. /** 
  51. * @param $meta_id 
  52. * @param $object_id 
  53. * @param $meta_key 
  54. * @param $_meta_value 
  55. */ 
  56. public function updated_user_meta($meta_id, $object_id, $meta_key, $_meta_value) { 
  57. if(in_array( $meta_key, $this->usermeta )) { 
  58. update_user_meta($object_id, '_user_modified_gmt', current_time( 'mysql', 1 )); 
  59.