1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace WC_POS;
13
14 class Customers {
15
16
17 private $usermeta = array(
18
19 'first_name',
20 'last_name',
21 'nickname',
22
23
24 '_order_count',
25 '_money_spent',
26
27
28 'billing_first_name',
29 'billing_last_name',
30 'billing_company',
31 'billing_email',
32 'billing_phone',
33 'billing_address_1',
34 'billing_address_2',
35 'billing_city',
36 'billing_state',
37 'billing_postcode',
38 'billing_country',
39
40 'shipping_first_name',
41 'shipping_last_name',
42 'shipping_company',
43 'shipping_address_1',
44 'shipping_address_2',
45 'shipping_city',
46 'shipping_state',
47 'shipping_postcode',
48 'shipping_country',
49 );
50
51 public function __construct() {
52 add_action( 'profile_update', array( $this, 'profile_update' ) );
53 add_action( 'updated_user_meta', array( $this, 'updated_user_meta' ), 10, 4);
54 }
55
56 57 58 59 60
61 public function profile_update($id){
62 update_user_meta($id, '_user_modified_gmt', current_time( 'mysql', 1 ));
63 }
64
65 66 67 68 69 70
71 public function updated_user_meta($meta_id, $object_id, $meta_key, $_meta_value){
72 if(in_array( $meta_key, $this->usermeta )){
73 update_user_meta($object_id, '_user_modified_gmt', current_time( 'mysql', 1 ));
74 }
75 }
76
77 }