Notes::record_tracks_event_with_user()public staticWC 1.0

Record tracks event for a specific user.

Метод класса: Notes{}

No Hooks.


null. Nothing.


$result = Notes::record_tracks_event_with_user( $user_id, $event_name, $params );
$user_id(int) (required)
The user id we want to record for the event.
$event_name(string) (required)
Name of the event to record.
$params(array) (required)
The params to send to the event recording.

Code of Notes::record_tracks_event_with_user() WC 7.1.0

public static function record_tracks_event_with_user( $user_id, $event_name, $params ) {
	// We save the current user id to set it back after the event recording.
	$current_user_id = get_current_user_id();

	wp_set_current_user( $user_id );
	self::record_tracks_event_without_cookies( $event_name, $params );
	wp_set_current_user( $current_user_id );