LLMS_Sessions::get_session_end( LLMS_Event $start )

Retrieve session end record for by session id.


Parameters Parameters

$start

(LLMS_Event) (Required) Event record for the session.start event.


Top ↑

Return Return

(LLMS_Event|end)


Top ↑

Source Source

File: includes/class-llms-sessions.php

	public function get_session_end( $start ) {

		global $wpdb;
		$end = $wpdb->get_var(
			$wpdb->prepare(
				"SELECT id
			   FROM {$wpdb->prefix}lifterlms_events
			  WHERE actor_id = %d
			    AND object_id = %d
			    AND object_type = 'session'
			    AND event_type = 'session'
			    AND event_action = 'end'
		   ORDER BY date DESC
			  LIMIT 1;",
				$start->get( 'actor_id' ),
				$start->get( 'object_id' )
			)
		); // db call ok; no-cache ok.

		if ( ! $end ) {
			return null;
		}

		return new LLMS_Event( $end );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.36.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.