Automattic\WooCommerce\Admin\API\Reports\Customers

DataStore::update_registered_customer_via_last_activepublic staticWC 1.0

Update the database if the "last active" meta value was changed. Function expects to be hooked into the added_user_meta updated_user_meta

Method of the class: DataStore{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = DataStore::update_registered_customer_via_last_active( $meta_id, $user_id, $meta_key );
$meta_id(int) (required)
ID of updated metadata entry.
$user_id(int) (required)
ID of the user being updated.
$meta_key(string) (required)
Meta key being updated.

DataStore::update_registered_customer_via_last_active() code WC 10.9.4

public static function update_registered_customer_via_last_active( $meta_id, $user_id, $meta_key ) {
	if ( 'wc_last_active' === $meta_key ) {
		// Optimization note related to guarded updates in `wc_update_user_last_active`: the meta update will trigger
		// this method execution. We evaluated adding `! doing_action( 'wp' )` here, but the performance gain lays
		// in the micro-optimization area while exposing the Analytics to certain edge-cases.
		self::update_registered_customer( $user_id );
	}
}