XF 1.2 Is there a function to send an alert to a user?

Stuart Wright

Well-known member
I'm writing a php script for a php callback in a standard page. There is a circumstance where I need to send an alert to me to let me know of a particular situation.
Is there a quick way to send an alert to my account?
send_alert($user_id,$message) ?
 
$alertModel = $this->getModelFromCache('XenForo_Model_Alert');
$alertModel->alert($alertUserId, $userId, $username, $contentType, $contentId, $action, $extraData);
 
This assumes you are using an existing content type which handles alerts.
If you wish to send alerts for custom types then you will need to create an add-on which fetches and displays your own content.
The simplest example would be to take a look at my Thread Ban add-on where I use alerts for my custom content type.
 
There is no alert function that will send any old text to a particular user.
If you want to notify a user about certain actions that exists in the system (such as replying, editing etc.) then you can use the default alert system by calling the alert function with appropriate action and content type.

Otherwise, to send an alert for your own 'action' you will need to create your own content type and alert handler. The alert handler fetches the content (if exists) and displays it together with the alert action.
 
Back
Top Bottom