Function __global->dispatch_notification

Definitions

sources/notifications.php

  • Send out a notification to members enabled.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$notification_code ID_TEXT No No required parameter N/A N/A The notification code to use. May be prefixed with the filename for faster performance where the filename doesn't match the code (allows the software to find the hook without scanning all notification hooks), i.e. filename:code.
$code_category ?SHORT_TEXT No No required parameter N/A N/A The category within the notification code (null: none)
$subject SHORT_TEXT No No required parameter N/A N/A Message subject (in Comcode)
$message LONG_TEXT No No required parameter N/A N/A Message body (in Comcode)
$to_member_ids ?array No No Null N/A N/A List of enabled members to limit sending to (null: everyone); ignores the member defined in $from_member_id
$from_member_id ?integer No No Null N/A N/A The member ID doing the sending. Either a MEMBER or a negative number (e.g. A_FROM_SYSTEM_UNPRIVILEGED) (null: current member); this member will be excluded from receiving the notification
$advanced_parameters array No No [] N/A N/A A map of additional parameters. See comments within this function implementation to know what can be sent.

Returns

  • The number of notifications delivered (null: unknown, as to be sent in the background)
  • Type: ?integer
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Send out a notification to members enabled.
 *
 * @param  ID_TEXT $notification_code The notification code to use. May be prefixed with the filename for faster performance where the filename doesn't match the code (allows the software to find the hook without scanning all notification hooks), i.e. filename:code.
 * @param  ?SHORT_TEXT $code_category The category within the notification code (null: none)
 * @param  SHORT_TEXT $subject Message subject (in Comcode)
 * @param  LONG_TEXT $message Message body (in Comcode)
 * @param  ?array $to_member_ids List of enabled members to limit sending to (null: everyone); ignores the member defined in $from_member_id
 * @param  ?integer $from_member_id The member ID doing the sending. Either a MEMBER or a negative number (e.g. A_FROM_SYSTEM_UNPRIVILEGED) (null: current member); this member will be excluded from receiving the notification
 * @param  array $advanced_parameters A map of additional parameters. See comments within this function implementation to know what can be sent.
 * @return ?integer The number of notifications delivered (null: unknown, as to be sent in the background)
 */

function dispatch_notification(string $notification_code, ?string $code_category, string $subject, string $message, ?array $to_member_ids = null, ?int $from_member_id = null, array $advanced_parameters = []) : ?int