Functions

Copy notification settings from a parent category to a child category.

copy_notifications_to_new_child(\ID_TEXT $notification_code, \ID_TEXT $id, \ID_TEXT $child_id) 
package core_notifications

Parameters

$notification_code

\ID_TEXT

Parent category type

$id

\ID_TEXT

Parent category ID

$child_id

\ID_TEXT

Child category ID

Disable notifications for all members on a certain notification type+category.

delete_all_notifications_on(\ID_TEXT $notification_code, \?SHORT_TEXT $notification_category) 
package core_notifications

Parameters

$notification_code

\ID_TEXT

The notification code

$notification_category

\?SHORT_TEXT

The category within the notification code (null: none)

Disable notifications for a member on a notification type+category. Chances are you don't want to call this, you want to call enable_notifications with $setting=A_NA. That'll stop the default coming back.

disable_notifications(\ID_TEXT $notification_code, \?SHORT_TEXT $notification_category, \?MEMBER $member_id = null
package core_notifications

Parameters

$notification_code

\ID_TEXT

The notification code to use

$notification_category

\?SHORT_TEXT

The category within the notification code (null: none)

$member_id

\?MEMBER

The member being de-signed up (null: current member)

Send out a notification to members enabled.

dispatch_notification(\ID_TEXT $notification_code, \?SHORT_TEXT $code_category, \SHORT_TEXT $subject, \LONG_TEXT $message, \?array $to_member_ids = null, \?integer $from_member_id = null, integer $priority = 3, boolean $store_in_staff_messaging_system = false, boolean $no_cc = false, \?ID_TEXT $no_notify_for__notification_code = null, \?SHORT_TEXT $no_notify_for__code_category = null, string $subject_prefix = '', string $subject_suffix = '', string $body_prefix = '', string $body_suffix = '', \?array $attachments = null, boolean $use_real_from = false
package core_notifications
range 1 5

Parameters

$notification_code

\ID_TEXT

The notification code to use

$code_category

\?SHORT_TEXT

The category within the notification code (null: none)

$subject

\SHORT_TEXT

Message subject (in Comcode)

$message

\LONG_TEXT

Message body (in Comcode)

$to_member_ids

\?array

List of enabled members to limit sending to (null: everyone)

$from_member_id

\?integer

The member ID doing the sending. Either a MEMBER or a negative number (e.g. A_FROM_SYSTEM_UNPRIVILEGED) (null: current member)

$priority

integer

The message priority (1=urgent, 3=normal, 5=low)

$store_in_staff_messaging_system

boolean

Whether to create a topic for discussion (ignored if the staff_messaging addon not installed)

$no_cc

boolean

Whether to NOT CC to the CC address

$no_notify_for__notification_code

\?ID_TEXT

DO NOT send notifications to: The notification code (null: no restriction)

$no_notify_for__code_category

\?SHORT_TEXT

DO NOT send notifications to: The category within the notification code (null: none / no restriction)

$subject_prefix

string

Only relevant if $store_in_staff_messaging_system is true: subject prefix for storage

$subject_suffix

string

Only relevant if $store_in_staff_messaging_system is true: subject suffix for storage

$body_prefix

string

Only relevant if $store_in_staff_messaging_system is true: body prefix for storage

$body_suffix

string

Only relevant if $store_in_staff_messaging_system is true: body suffix for storage

$attachments

\?array

A list of attachments (each attachment being a map, path=>filename) (null: none)

$use_real_from

boolean

Whether we will make a "reply to" direct -- we only do this if we're allowed to disclose email addresses for this particular notification type (i.e. if it's a direct contact)

Enable notifications for a member on a notification type+category.

enable_notifications(\ID_TEXT $notification_code, \?SHORT_TEXT $notification_category, \?MEMBER $member_id = null, \?integer $setting = null
package core_notifications

Parameters

$notification_code

\ID_TEXT

The notification code to use

$notification_category

\?SHORT_TEXT

The category within the notification code (null: none)

$member_id

\?MEMBER

The member being signed up (null: current member)

$setting

\?integer

Setting to use (null: default)

Get PTs templating.

get_pts(\?integer $max = null, integer $start = 0) : array
package core_notifications

Parameters

$max

\?integer

Number of PTs to show (null: no limit)

$start

integer

Start offset

Returns

arrayA pair: Templating, Max rows

Get web notification templating.

get_web_notifications(\?integer $max = null, integer $start = 0) : array
package core_notifications

Parameters

$max

\?integer

Number of notifications to show (null: no limit)

$start

integer

Start offset

Returns

arrayA pair: Templating, Max rows

Notification entry script.

notification_display_script() 

Find whether a notification is locked-down (i.e. cannot be set).

notification_locked_down(\ID_TEXT $notification_code) : boolean
package core_notifications

Parameters

$notification_code

\ID_TEXT

The notification code to check

Returns

booleanWhether it is

Notification entry script.

notification_mark_all_read_script() 

Notification entry script.

notification_poller_script() 

Notification entry script.

notification_script() 

Find whether notifications are enabled for a member on a notification type+category. Does not check security (must go through notification object for that).

notifications_enabled(\ID_TEXT $notification_code, \?SHORT_TEXT $notification_category, \?MEMBER $member_id = null) : boolean
package core_notifications

Parameters

$notification_code

\ID_TEXT

The notification code to check

$notification_category

\?SHORT_TEXT

The category within the notification code (null: none)

$member_id

\?MEMBER

The member being de-signed up (null: current member)

Returns

booleanWhether they are

Find how notifications are enabled for a member on a notification type+category. Does not check security (must go through notification object for that).

notifications_setting(\ID_TEXT $notification_code, \?SHORT_TEXT $notification_category, \?MEMBER $member_id = null) : integer
package core_notifications

Parameters

$notification_code

\ID_TEXT

The notification code to check

$notification_category

\?SHORT_TEXT

The category within the notification code (null: none)

$member_id

\?MEMBER

The member being de-signed up (null: current member)

Returns

integerHow they are

Put out a user interface for managing notifications overall.

notifications_ui(\MEMBER $member_id_of) : \Tempcode
package core_notifications

Parameters

$member_id_of

\MEMBER

Member this is for

Returns

\TempcodeUI

Put out a user interface for managing notifications for a notification-category supporting content type. Also toggle notifications if an ID is passed.

notifications_ui_advanced(\ID_TEXT $notification_code, \?Tempcode $enable_message = null, \?Tempcode $disable_message = null) : \Tempcode
package core_notifications

Parameters

$notification_code

\ID_TEXT

The notification code to work with

$enable_message

\?Tempcode

Special message to output if we have toggled to enable (null: use standard)

$disable_message

\?Tempcode

Special message to output if we have toggled to disable (null: use standard)

Returns

\TempcodeUI

Get XML for sending a PT alert to the current user's web browser.

pt_to_xml(array $row) : string
package core_notifications

Parameters

$row

array

Notification row

Returns

stringThe XML

Get XML for sending a notification to the current user's web browser.

web_notification_to_xml(array $row) : string
package core_notifications

Parameters

$row

array

Notification row

Returns

stringThe XML

Classes, interfaces, and traits

Hook_Notification

Base class for notification hooks. Provides default implementations for all methods that provide full access to everyone, and interact with enabled table.

« More »

Hook_notification__Staff

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

« More »

Notification_dispatcher

Dispatcher object.

« More »

Constants

 

A_FROM_SYSTEM_PRIVILEGED

A_FROM_SYSTEM_PRIVILEGED = -2 
 

A_FROM_SYSTEM_UNPRIVILEGED

A_FROM_SYSTEM_UNPRIVILEGED = -3 
 

A_TO_ANYONE_ENABLED

A_TO_ANYONE_ENABLED = null 
 

NOTIFICATION_POLL_FREQUENCY

NOTIFICATION_POLL_FREQUENCY = intval(get_option('notification_poll_frequency')) 
 

NOTIFICATION_POLL_SAFETY_LAG_SECS

NOTIFICATION_POLL_SAFETY_LAG_SECS = 8