Notes::record_tracks_event_with_user()public staticWC 1.0

Record tracks event for a specific user.

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

Хуков нет.


null. Ничего (null).


$result = Notes::record_tracks_event_with_user( $user_id, $event_name, $params );
$user_id(int) (обязательный)
The user id we want to record for the event.
$event_name(строка) (обязательный)
Name of the event to record.
$params(массив) (обязательный)
The params to send to the event recording.

Код Notes::record_tracks_event_with_user() WC 8.5.2

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 );