Show:

Streams_Invite Class

Extends Base_Streams_Invite
Module: Streams

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

Methods

__set_state

(
  • $array
)
Streams_Invite

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

Parameters:

  • $array Array

Returns:

Streams_Invite:

Class instance

accept

(
  • $options
)
Streams_Participant | False | Null

Accept the invite and set up user's access levels If invite was already accepted, this function simply returns null

Parameters:

  • $options Array

    Things to do with the logged-in user

    • [subscribe=false] Boolean optional

      Whether to auto-subscribe them to the stream if not already subscribed. If the subscribe() call throws an exception, it is swallowed.

    • [access=true] Boolean optional

      Whether to upgrade their access to the stream

Returns:

Streams_Participant | False | Null:

beforeSave

(
  • $modifiedFields
)
Array

Assigns unique id to 'token' field if not set Saves corresponding row in Streams_Invited table Inserting a new invite affects corresponding row in Streams_Participant table

Parameters:

  • $modifiedFields Array

    The fields that have been modified

Returns:

Array:

beforeSave

(
  • $pk
)
Boolean

Also removes counterpart row in Streams_Invited table

Parameters:

  • $pk Array

    The primary key fields

Returns:

Boolean:

forStream

(
  • $publisherId
  • $streamName
  • $userId
)
Array | Streams_Invite | Null static

Get the invites that have been left for one or more users in some stream. This is useful for auto-accepting them or presenting the user with a button to accept the invite when the stream is rendered on their client.

Parameters:

Returns:

Array | Streams_Invite | Null:

an array of Streams_Invite objects, or if $streamName and $userId are strings, just returns Streams_Invite or null.

getInvite

(
  • $token
  • $throwIfMissing
)
Streams_Invite | Null static

Retrieves invite

Parameters:

  • $token String
  • $throwIfMissing Boolean

Returns:

Streams_Invite | Null:

setUp

()

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

Events

Streams/invite

Before

Event Payload:

Streams/invite

After

Event Payload: