Alert
in package
Provides access to create & get alerts for a user, as well as their PMs.
Tags
Table of Contents
Methods
- create() : void
- Creates an alert for the specified user.
- getAlerts() : array<string|int, mixed>
- Get user alerts.
- getPMs() : array<string|int, mixed>
- Get a users unread messages.
- send() : void
- Post a new alert to a user.
Methods
create()
Creates an alert for the specified user.
public
static create(int $user_id, string $type, array<string|int, mixed> $text_short, array<string|int, mixed> $text[, string|null $link = '#' ][, string|null $content = null ]) : void
Use Alert::send instead
Parameters
- $user_id : int
-
Contains the ID of the user who we are creating the alert for.
- $type : string
-
Contains the alert type, eg 'tag' for user tagging.
- $text_short : array<string|int, mixed>
-
Contains the alert text in short form for the dropdown.
- $text : array<string|int, mixed>
-
Contains full information about the alert.
- $link : string|null = '#'
-
Contains link to view the alert, defaults to #.
- $content : string|null = null
-
Optional alert content.
getAlerts()
Get user alerts.
public
static getAlerts(int $user_id[, bool $all = false ]) : array<string|int, mixed>
Parameters
- $user_id : int
-
Contains the ID of the user who we are getting alerts for.
- $all : bool = false
-
Do we want to get all alerts (including read), or not; defaults to false).
Return values
array<string|int, mixed> —All their alerts.
getPMs()
Get a users unread messages.
public
static getPMs(int $user_id[, bool $all = false ]) : array<string|int, mixed>
Parameters
- $user_id : int
-
The ID of the user who we are getting messages for.
- $all : bool = false
-
Get all alerts (including read), or not. Defaults to false.
Return values
array<string|int, mixed> —All their messages matching the $all filter.
send()
Post a new alert to a user.
public
static send(int $userId, string $title, string $content[, string|null $link = '' ][, bool $skipPurify = false ]) : void
Parameters
- $userId : int
- $title : string
- $content : string
- $link : string|null = ''
-
Optional link to redirect the user to on click
- $skipPurify : bool = false
-
If true the content will not be purified before displaying to user - use with care