• Developer guides

Notifications

Using the Notifications API you can send notifications to your module’s users.

Note: the maximum length for the notification’s body is 255 characters.

Example PHP

<?php

// Initialize the Notification object
$not = new Notification();

// Set data (all three fields are required)
$not->body = 'You have one To Do item that is due!'; // Notification text
$not->link = '/todo/?item=493932'; // URL that the notification will lead to
$not->user = 19583; // The receiver's user ID

// It is also possible to send the notification at a certain time
// Do not set this value to send it immeadiatly
$not->time = time() + 86400; // Tomorrow

// Send the notification
$not->send();