Show:

Users_Session Class

Extends Base_Users_Session
Module: Users

Class representing 'Session' rows in the 'Users' database You can create an object of this class either to access its non-static methods, or to actually represent a session row in the Users database.

Methods

__set_state

(
  • $array
)
Users_Session

Implements the __set_state method, so it can work with with var_export and be re-imported successfully.

Parameters:

  • $array Array

Returns:

Users_Session:

Class instance

copyToNewSesion

(
  • $sessionFields
  • [$duration='year']
)
String static

Saves a new Users_Session row with a copy of all the content from the current session. Does not change the current session id.

Parameters:

  • $sessionFields Array

    Pass an array with keys such as "platform", "appId", "version", "deviceId", "formFactor"

  • [$duration='year'] String | Integer optional

    The key in the Q/session/durations config field or number of seconds. Pass 0 to expire at the end of browser session.

Returns:

String:

the id of the newly saved Users_Session row

setUp

()

The setUp() method is called the first time an object of this class is constructed.

Events

Users/Session/copyToNewSession

After

This is a hook for after the session has been copied to a new session. You may want to do extra security checks here. You may also want to notify the user that there has been a new session started from a new platform + appId.

Event Payload: