Clanbite

clanbite_notify( int $user_id, string $type, string $title, array $args = array() ): int|\WP_Error

Send a notification to a user.

Parameters

$user_id (int) Required

User to notify.

$type (string) Required

Notification type slug (e.g., 'team_invite', 'friend_request').

$title (string) Required

Short notification title.

$args (array<string, mixed>) Optional

Optional arguments.

Default: array()

  • $message string Longer message text.
  • $url string Link URL when notification is clicked.
  • $actor_id int User who triggered the notification.
  • $object_type string Related object type (e.g., 'team', 'post', 'comment').
  • $object_id int Related object ID.
  • $data array Additional data to store (will be JSON encoded).
  • $actions array Action buttons. Each action is an array with: – key: (string) Unique action identifier (e.g., 'accept', 'decline'). – label: (string) Button label. – style: (string) 'primary', 'secondary', or 'danger'. Default 'secondary'. – handler: (string) Handler identifier for the action. – status: (string) Status to set after action ('accepted', 'declined', 'dismissed'). – success_message: (string) Message to show on success. – confirm: (string|false) Confirmation message, or false for no confirm.
  • $dedupe bool If true, won't create if similar notification exists. Default true.

Returns

int|\WP_Error Notification ID or error.

Defined in inc/extensions/notifications/functions.php