LLMS_Sessions::get_current( int $user_id = null )
Retrieve the current session start event record for a given user.
Parameters Parameters
- $user_id
-
(int) (Optional) WP_User ID of a student. Default
nullIf not provided, or a falsy is provided, will fall back on the current user id.Default value: null
Return Return
(LLMS_Event|false)
Source Source
File: includes/class-llms-sessions.php
public function get_current( $user_id = null ) {
$user_id = $user_id ? $user_id : get_current_user_id();
if ( ! $user_id ) {
return false;
}
$session = $this->get_last_session( $user_id );
if ( ! $session ) {
return false;
}
$session = new LLMS_Event( $session->id );
if ( ! $this->is_session_open( $session ) ) {
return false;
}
return $session;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.5.0 | Added optional $user_id parameter. |
| 3.36.0 | Introduced. |