wc_meta_update_last_update_time

Hooks into the update user meta function to set the user last updated timestamp.

Description

wc_meta_update_last_update_time( (int) $meta_id, (int) $user_id, (string) $meta_key, (string) $_meta_value ); 

Parameters (4)

0. $meta_id (int)
ID of the meta object that was changed.
1. $user_id (int)
The user that was updated.
2. $meta_key (string)
Name of the meta key that was changed.
3. $meta_value (string)
Value of the meta that was changed.

Usage

  1. if ( !function_exists( 'wc_meta_update_last_update_time' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-user-functions.php'; 
  3.  
  4. // ID of the meta object that was changed. 
  5. $meta_id = -1; 
  6.  
  7. // The user that was updated. 
  8. $user_id = -1; 
  9.  
  10. // Name of the meta key that was changed. 
  11. $meta_key = ''; 
  12.  
  13. // Value of the meta that was changed. 
  14. $meta_value = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wc_meta_update_last_update_time($meta_id, $user_id, $meta_key, $meta_value); 
  18.  

Defined (1)

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

/includes/wc-user-functions.php  
  1. function wc_meta_update_last_update_time( $meta_id, $user_id, $meta_key, $_meta_value ) { 
  2. $keys_to_track = apply_filters( 'woocommerce_user_last_update_fields', array( 'first_name', 'last_name' ) ); 
  3. $update_time = false; 
  4. if ( in_array( $meta_key, $keys_to_track ) ) { 
  5. $update_time = true; 
  6. if ( 'billing_' === substr( $meta_key, 0, 8 ) ) { 
  7. $update_time = true; 
  8. if ( 'shipping_' === substr( $meta_key, 0, 9 ) ) { 
  9. $update_time = true; 
  10.  
  11. if ( $update_time ) {