Derived abstract base class of notification hooks that provides only staff access.

package core_notifications
inherited_from \Hook_Notification

 Methods

Find a bitmask of settings (email, SMS, etc) a notification code supports for listening on.

allowed_settings(\ID_TEXT $notification_code) : integer
Inherited

Parameters

$notification_code

\ID_TEXT

Notification code

Returns

integerAllowed settings

Standard function to create the standardised category tree. This base version will do it based on seeing what is already being monitored, i.e. so you can unmonitor them. It assumes monitoring is initially set from the frontend via the monitor button.

create_category_tree(\ID_TEXT $notification_code, \?ID_TEXT $id) : array
Inherited

Parameters

$notification_code

\ID_TEXT

Notification code

$id

\?ID_TEXT

The ID of where we're looking under (null: N/A)

Returns

arrayTree structure

Find the setting that members have for a notification code if they have done some action triggering automatic setting (e.g. posted within a topic).

get_default_auto_setting(\ID_TEXT $notification_code, \?SHORT_TEXT $category = null) : integer
Inherited

Parameters

$notification_code

\ID_TEXT

Notification code

$category

\?SHORT_TEXT

The category within the notification code (null: none)

Returns

integerAutomatic setting

Find the initial setting that members have for a notification code (only applies to the member_could_potentially_enable members).

get_initial_setting(\ID_TEXT $notification_code, \?SHORT_TEXT $category = null) : integer
Inherited

Parameters

$notification_code

\ID_TEXT

Notification code

$category

\?SHORT_TEXT

The category within the notification code (null: none)

Returns

integerInitial setting

Get a list of all the notification codes this hook can handle.

list_handled_codes() : array

(Addons can define hooks that handle whole sets of codes, so hooks are written so they can take wide authority)

inherited_from \Hook_Notification::list_handled_codes()

Returns

arrayList of codes (mapping between code names, and a pair: section and labelling for those codes)

Get a list of all the notification codes this hook can handle.

list_handled_codes() : array
Inherited

(Addons can define hooks that handle whole sets of codes, so hooks are written so they can take wide authority)

Returns

arrayList of codes (mapping between code names, and a pair: section and labelling for those codes)

Get a list of members who have enabled this notification (i.e. have permission to AND have chosen to or are defaulted to).

list_members_who_have_enabled(\ID_TEXT $notification_code, \?SHORT_TEXT $category = null, \?array $to_member_ids = null, integer $start = 0, integer $max = 300) : array
inherited_from \Hook_Notification::list_members_who_have_enabled()

Parameters

$notification_code

\ID_TEXT

Notification code

$category

\?SHORT_TEXT

The category within the notification code (null: none)

$to_member_ids

\?array

List of member IDs we are restricting to (null: no restriction). This effectively works as a intersection set operator against those who have enabled.

$start

integer

Start position (for pagination)

$max

integer

Maximum (for pagination)

Returns

arrayA pair: Map of members to their notification setting, and whether there may be more

Get a list of members who have enabled this notification (i.e. have permission to AND have chosen to or are defaulted to).

list_members_who_have_enabled(\ID_TEXT $notification_code, \?SHORT_TEXT $category = null, \?array $to_member_ids = null, integer $start = 0, integer $max = 300) : array
Inherited

Parameters

$notification_code

\ID_TEXT

Notification code

$category

\?SHORT_TEXT

The category within the notification code (null: none)

$to_member_ids

\?array

List of member IDs we are restricting to (null: no restriction). This effectively works as a intersection set operator against those who have enabled.

$start

integer

Start position (for pagination)

$max

integer

Maximum (for pagination)

Returns

arrayA pair: Map of members to their notification setting, and whether there may be more

Find whether a member could enable this notification (i.e. have permission to).

member_could_potentially_enable(\ID_TEXT $notification_code, \MEMBER $member_id, \?SHORT_TEXT $category = null) : boolean
inherited_from \Hook_Notification::member_could_potentially_enable()

Parameters

$notification_code

\ID_TEXT

Notification code

$member_id

\MEMBER

Member to check against

$category

\?SHORT_TEXT

The category within the notification code (null: none)

Returns

booleanWhether they could

Find whether a member could enable this notification (i.e. have permission to).

member_could_potentially_enable(\ID_TEXT $notification_code, \MEMBER $member_id, \?SHORT_TEXT $category = null) : boolean
Inherited

Parameters

$notification_code

\ID_TEXT

Notification code

$member_id

\MEMBER

Member to check against

$category

\?SHORT_TEXT

The category within the notification code (null: none)

Returns

booleanWhether they could

Find whether a member has enabled this notification (i.e. have permission to AND have chosen to or are defaulted to).

member_has_enabled(\ID_TEXT $notification_code, \MEMBER $member_id, \?SHORT_TEXT $category = null) : boolean

(Separate implementation to list_members_who_have_enabled, for performance reasons.)

inherited_from \Hook_Notification::member_has_enabled()

Parameters

$notification_code

\ID_TEXT

Notification code

$member_id

\MEMBER

Member to check against

$category

\?SHORT_TEXT

The category within the notification code (null: none)

Returns

booleanWhether they are

Find whether a member has enabled this notification (i.e. have permission to AND have chosen to or are defaulted to).

member_has_enabled(\ID_TEXT $notification_code, \MEMBER $member_id, \?SHORT_TEXT $category = null) : boolean
Inherited

(Separate implementation to list_members_who_have_enabled, for performance reasons.)

Parameters

$notification_code

\ID_TEXT

Notification code

$member_id

\MEMBER

Member to check against

$category

\?SHORT_TEXT

The category within the notification code (null: none)

Returns

booleanWhether they have

Find whether a handled notification code supports categories.

supports_categories(\ID_TEXT $notification_code) : boolean
Inherited

(Content types, for example, will define notifications on specific categories, not just in general. The categories are interpreted by the hook and may be complex. E.g. it might be like a regexp match, or like FORUM:3 or TOPIC:100)

Parameters

$notification_code

\ID_TEXT

Notification code

Returns

booleanWhether it does

Get a list of members who have enabled this notification (i.e. have chosen to or are defaulted to).

_all_members_who_have_enabled(\ID_TEXT $only_if_enabled_on__notification_code, \?SHORT_TEXT $only_if_enabled_on__category, \?array $to_member_ids, integer $start, integer $max, boolean $catch_all_too = true) : array
Inherited

(No pagination supported, as assumed there are only a small set of members here.)

Parameters

$only_if_enabled_on__notification_code

\ID_TEXT

Notification code

$only_if_enabled_on__category

\?SHORT_TEXT

The category within the notification code (null: none)

$to_member_ids

\?array

List of member IDs we are restricting to (null: no restriction). This effectively works as a intersection set operator against those who have enabled.

$start

integer

Start position (for pagination)

$max

integer

Maximum (for pagination)

$catch_all_too

boolean

Whether to find members who are subscribed regardless of notification code

Returns

arrayA pair: Map of members to their notification setting, and whether there may be more

Further filter results from _all_members_who_have_enabled.

_all_members_who_have_enabled_with_category_access(array $to_filter, \ID_TEXT $category, \ID_TEXT $only_if_enabled_on__notification_code, \?SHORT_TEXT $only_if_enabled_on__category, \?array $to_member_ids, integer $start, integer $max) : array
Inherited

Parameters

$to_filter

array

Members from main query (we'll filter them)

$category

\ID_TEXT

The category permission type

$only_if_enabled_on__notification_code

\ID_TEXT

Notification code

$only_if_enabled_on__category

\?SHORT_TEXT

The category within the notification code (null: none)

$to_member_ids

\?array

List of member IDs we are restricting to (null: no restriction). This effectively works as a intersection set operator against those who have enabled.

$start

integer

Start position (for pagination)

$max

integer

Maximum (for pagination)

Returns

arrayA pair: Map of members to their notification setting, and whether there may be more

Further filter results from _all_members_who_have_enabled.

_all_members_who_have_enabled_with_page_access(array $to_filter, \ID_TEXT $page, \ID_TEXT $only_if_enabled_on__notification_code, \?SHORT_TEXT $only_if_enabled_on__category, \?array $to_member_ids, integer $start, integer $max) : array
Inherited

Parameters

$to_filter

array

Members from main query (we'll filter them)

$page

\ID_TEXT

The page

$only_if_enabled_on__notification_code

\ID_TEXT

Notification code

$only_if_enabled_on__category

\?SHORT_TEXT

The category within the notification code (null: none)

$to_member_ids

\?array

List of member IDs we are restricting to (null: no restriction). This effectively works as a intersection set operator against those who have enabled.

$start

integer

Start position (for pagination)

$max

integer

Maximum (for pagination)

Returns

arrayA pair: Map of members to their notification setting, and whether there may be more

Further filter results from _all_members_who_have_enabled.

_all_members_who_have_enabled_with_privilege(array $to_filter, \ID_TEXT $privilege, \ID_TEXT $only_if_enabled_on__notification_code, \?SHORT_TEXT $only_if_enabled_on__category, \?array $to_member_ids, integer $start, integer $max) : array
Inherited

Parameters

$to_filter

array

Members from main query (we'll filter them)

$privilege

\ID_TEXT

The privilege

$only_if_enabled_on__notification_code

\ID_TEXT

Notification code

$only_if_enabled_on__category

\?SHORT_TEXT

The category within the notification code (null: none)

$to_member_ids

\?array

List of member IDs we are restricting to (null: no restriction). This effectively works as a intersection set operator against those who have enabled.

$start

integer

Start position (for pagination)

$max

integer

Maximum (for pagination)

Returns

arrayA pair: Map of members to their notification setting, and whether there may be more

Further filter results from _all_members_who_have_enabled.

_all_members_who_have_enabled_with_zone_access(array $to_filter, \ID_TEXT $zone, \ID_TEXT $only_if_enabled_on__notification_code, \?SHORT_TEXT $only_if_enabled_on__category, \?array $to_member_ids, integer $start, integer $max) : array
Inherited

Parameters

$to_filter

array

Members from main query (we'll filter them)

$zone

\ID_TEXT

The zone

$only_if_enabled_on__notification_code

\ID_TEXT

Notification code

$only_if_enabled_on__category

\?SHORT_TEXT

The category within the notification code (null: none)

$to_member_ids

\?array

List of member IDs we are restricting to (null: no restriction). This effectively works as a intersection set operator against those who have enabled.

$start

integer

Start position (for pagination)

$max

integer

Maximum (for pagination)

Returns

arrayA pair: Map of members to their notification setting, and whether there may be more

Get a list of staff members who have enabled this notification (i.e. have permission to AND have chosen to or are defaulted to).

_all_staff_who_have_enabled(\ID_TEXT $only_if_enabled_on__notification_code, \?SHORT_TEXT $only_if_enabled_on__category, \?array $to_member_ids, integer $start, integer $max) : array

Parameters

$only_if_enabled_on__notification_code

\ID_TEXT

Notification code

$only_if_enabled_on__category

\?SHORT_TEXT

The category within the notification code (null: none)

$to_member_ids

\?array

List of member IDs we are restricting to (null: no restriction). This effectively works as a intersection set operator against those who have enabled.

$start

integer

Start position (for pagination)

$max

integer

Maximum (for pagination)

Returns

arrayA pair: Map of members to their notification setting, and whether there may be more

Standard function to create the standardised category tree. This base version will do it based on seeing what is already being monitored, i.e. so you can unmonitor them. It assumes monitoring is initially set from the frontend via the monitor button.

_create_category_tree(\ID_TEXT $notification_code, \?ID_TEXT $id, boolean $for_any_member = false) : array
Inherited

Parameters

$notification_code

\ID_TEXT

Notification code

$id

\?ID_TEXT

The ID of where we're looking under (null: N/A)

$for_any_member

boolean

Whether to list anything monitored by any member (useful if you are calling this because you can't naturally enumerate what can be monitored)

Returns

arrayTree structure

Find whether someone has permission to view any notifications (yes) and possibly if they actually are.

_is_member(\?ID_TEXT $only_if_enabled_on__notification_code, \?SHORT_TEXT $only_if_enabled_on__category, \MEMBER $member_id) : boolean
Inherited

Parameters

$only_if_enabled_on__notification_code

\?ID_TEXT

Notification code (null: don't check if they are)

$only_if_enabled_on__category

\?SHORT_TEXT

The category within the notification code (null: none)

$member_id

\MEMBER

Member to check against

Returns

booleanWhether they do

Find whether someone has permission to view staff notifications and possibly if they actually are.

_is_staff(\?ID_TEXT $only_if_enabled_on__notification_code, \?SHORT_TEXT $only_if_enabled_on__category, \MEMBER $member_id) : boolean

Parameters

$only_if_enabled_on__notification_code

\?ID_TEXT

Notification code (null: don't check if they are)

$only_if_enabled_on__category

\?SHORT_TEXT

The category within the notification code (null: none)

$member_id

\MEMBER

Member to check against

Returns

booleanWhether they do