LLMS_Events::store_tracking_events( string $tracking )
Store event data saved in the tracking cookie.
Parameters Parameters
- $tracking
-
(string) (Required) The
llms-trackingdata in JSON format.
Return Return
((boolean|WP_Error)) Returns WP_Error when nonce verification fails or unauthenticated user, true otherwise.
Source Source
File: includes/class-llms-events.php
public function store_tracking_events( $tracking ) {
$tracking = json_decode( $tracking, true );
if ( ! empty( $tracking['nonce'] ) && wp_verify_nonce( $tracking['nonce'], 'llms-tracking' ) && get_current_user_id() ) {
if ( ! empty( $tracking['events'] ) && is_array( $tracking['events'] ) ) {
foreach ( $tracking['events'] as $event ) {
$event = $this->prepare_event( $event );
if ( ! is_wp_error( $event ) ) {
$this->record( $event );
}
}
}
} else {
return new WP_Error( 'llms_events_tracking_unauthorized', __( 'You\'re not allowed to store tracking events', 'lifterlms' ) );
}
return true;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.37.14 | Introduced. |