Overview
  • Namespace
  • Class

Namespaces

  • None
  • WC_POS
    • Admin
      • Settings
        • Receipt
    • API
    • Gateways
    • Integrations
    • Products

Classes

  • WC_POS\Activator
  • WC_POS\Admin
  • WC_POS\Admin\Gateways
  • WC_POS\Admin\Menu
  • WC_POS\Admin\Notices
  • WC_POS\Admin\Orders
  • WC_POS\Admin\Page
  • WC_POS\Admin\Permalink
  • WC_POS\Admin\Plugins
  • WC_POS\Admin\Products
  • WC_POS\Admin\Settings
  • WC_POS\Admin\Settings\Access
  • WC_POS\Admin\Settings\Checkout
  • WC_POS\Admin\Settings\Customers
  • WC_POS\Admin\Settings\Gateways
  • WC_POS\Admin\Settings\General
  • WC_POS\Admin\Settings\HotKeys
  • WC_POS\Admin\Settings\Page
  • WC_POS\Admin\Settings\Receipt\Options
  • WC_POS\Admin\Settings\Receipt\Template
  • WC_POS\Admin\Settings\Receipts
  • WC_POS\Admin\Settings\Status
  • WC_POS\Admin\Settings\Tools
  • WC_POS\Admin\Status
  • WC_POS\Ajax
  • WC_POS\API
  • WC_POS\API\Coupons
  • WC_POS\API\Customers
  • WC_POS\API\Gateways
  • WC_POS\API\i18n
  • WC_POS\API\Orders
  • WC_POS\API\Params
  • WC_POS\API\Payload
  • WC_POS\API\Products
  • WC_POS\API\Settings
  • WC_POS\API\Support
  • WC_POS\API\Templates
  • WC_POS\Customers
  • WC_POS\Deactivator
  • WC_POS\Gateways
  • WC_POS\Gateways\Card
  • WC_POS\Gateways\Cash
  • WC_POS\i18n
  • WC_POS\Integrations\Bookings
  • WC_POS\Products
  • WC_POS\Products\Visibility
  • WC_POS\Setup
  • WC_POS\Status
  • WC_POS\Tax
  • WC_POS\Template

Functions

  • is_pos
  • is_pos_admin
  • wc_pos_get_option
  • wc_pos_json_encode
  • wc_pos_locate_template
  • wc_pos_trim_html_string
  • wc_pos_update_option
  • wc_pos_url
 1 <?php
 2 
 3 /**
 4  * POS Customers
 5  *
 6  * @class    WC_POS_Customers
 7  * @package  WooCommerce POS
 8  * @author   Paul Kilmurray <paul@kilbot.com.au>
 9  * @link     http://www.woopos.com.au
10  */
11 
12 namespace WC_POS;
13 
14 class Customers {
15 
16   // whitelist of usermeta which triggers _user_modified_gmt update
17   private $usermeta = array(
18     // wp data
19     'first_name',
20     'last_name',
21     'nickname',
22 
23     // woo order data
24     '_order_count',
25     '_money_spent',
26 
27     // woo customer data
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    * WP Users has not modified date
58    * POS needs to track which customer profiles have been updated
59    * @param $id
60    */
61   public function profile_update($id){
62     update_user_meta($id, '_user_modified_gmt', current_time( 'mysql', 1 ));
63   }
64 
65   /**
66    * @param $meta_id
67    * @param $object_id
68    * @param $meta_key
69    * @param $_meta_value
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 }
API documentation generated by ApiGen