phpBB API Documentation
Interface

phpbb\notification\method\method_interface

interface method_interface

Base notifications method interface

Methods

string get_type()

Get notification method name

bool is_enabled_by_default()

Is the method enable by default?

is_available()

Is this method available for the user? This is checked on the notifications options

array get_notified_users(int $notification_type_id, array $options)

Return the list of the users already notified

array load_notifications(array $options = array())

Load the user's notifications

add_to_queue(type_interface $notification)

Add a notification to the queue

notify()

Parse the queue and notify the users

update_notification(type_interface $notification, array $data, array $options)

Update a notification

mark_notifications(bool|string $notification_type_id, bool|int|array $item_id, bool|int|array $user_id, bool|int $time = false, bool $mark_read = true)

Mark notifications read or unread

mark_notifications_by_parent(string $notification_type_id, bool|int|array $item_parent_id, bool|int|array $user_id, bool|int $time = false, bool $mark_read = true)

Mark notifications read or unread from a parent identifier

mark_notifications_by_id(int $notification_id, bool|int $time = false, bool $mark_read = true)

Mark notifications read or unread

delete_notifications(string $notification_type_id, int|array $item_id, mixed $parent_id = false, mixed $user_id = false)

Delete a notification

prune_notifications(int $timestamp, bool $only_read = true)

Delete all notifications older than a certain time

purge_notifications(string $notification_type_id)

Purge all notifications of a certain type

Details

at line 26
public string get_type()

Get notification method name

Return Value

string

at line 33
public bool is_enabled_by_default()

Is the method enable by default?

Return Value

bool

at line 39
public is_available()

Is this method available for the user? This is checked on the notifications options

at line 48
public array get_notified_users(int $notification_type_id, array $options)

Return the list of the users already notified

Parameters

int $notification_type_id Type of the notification
array $options

Return Value

array User

at line 68
public array load_notifications(array $options = array())

Load the user's notifications

Parameters

array $options Optional options to control what notifications are loaded notificationid Notification id to load (or array of notification ids) userid User id to load notifications for (Default: $user->data['userid']) orderby Order by (Default: notificationtime) orderdir Order direction (Default: DESC) limit Number of notifications to load (Default: 5) start Notifications offset (Default: 0) allunread Load all unread notifications? If set to true, countunread is set to true (Default: false) countunread Count all unread notifications? (Default: false) counttotal Count all notifications? (Default: false)

Return Value

array Array of information based on the request with keys: 'notifications' array of notification type objects 'unreadcount' number of unread notifications the user has if countunread is true in the options 'totalcount' number of notifications the user has if counttotal is true in the options

at line 75
public add_to_queue(type_interface $notification)

Add a notification to the queue

Parameters

type_interface $notification

at line 80
public notify()

Parse the queue and notify the users

at line 89
public update_notification(type_interface $notification, array $data, array $options)

Update a notification

Parameters

type_interface $notification Notification to update
array $data Data specific for this type that will be updated
array $options

at line 100
public mark_notifications(bool|string $notification_type_id, bool|int|array $item_id, bool|int|array $user_id, bool|int $time = false, bool $mark_read = true)

Mark notifications read or unread

Parameters

bool|string $notification_type_id Type identifier of item types. False to mark read for all item types
bool|int|array $item_id Item id or array of item ids. False to mark read for all item ids
bool|int|array $user_id User id or array of user ids. False to mark read for all user ids
bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False)
bool $mark_read Define if the notification as to be set to True or False. (Default: True)

at line 111
public mark_notifications_by_parent(string $notification_type_id, bool|int|array $item_parent_id, bool|int|array $user_id, bool|int $time = false, bool $mark_read = true)

Mark notifications read or unread from a parent identifier

Parameters

string $notification_type_id Type identifier of item types
bool|int|array $item_parent_id Item parent id or array of item parent ids. False to mark read for all item parent ids
bool|int|array $user_id User id or array of user ids. False to mark read for all user ids
bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False)
bool $mark_read Define if the notification as to be set to True or False. (Default: True)

at line 120
public mark_notifications_by_id(int $notification_id, bool|int $time = false, bool $mark_read = true)

Mark notifications read or unread

Parameters

int $notification_id Notification id of notification ids.
bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False)
bool $mark_read Define if the notification as to be set to True or False. (Default: True)

at line 130
public delete_notifications(string $notification_type_id, int|array $item_id, mixed $parent_id = false, mixed $user_id = false)

Delete a notification

Parameters

string $notification_type_id Type identifier of item types
int|array $item_id Identifier within the type (or array of ids)
mixed $parent_id Parent identifier within the type (or array of ids), used in combination with item_id if specified (Default: false; not checked)
mixed $user_id User id (Default: false; not checked)

at line 138
public prune_notifications(int $timestamp, bool $only_read = true)

Delete all notifications older than a certain time

Parameters

int $timestamp Unix timestamp to delete all notifications that were created before
bool $only_read True (default) to only prune read notifications

at line 148
public purge_notifications(string $notification_type_id)

Purge all notifications of a certain type

This should be called when an extension which has notification types is purged so that all those notifications are removed

Parameters

string $notification_type_id Type identifier of the subscription