1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-19 04:41:53 +02:00

Closes #4922 - Option for plugins to extend notification routing.

This commit is contained in:
Cameron
2022-12-13 18:23:48 -08:00
parent f85de1ba5b
commit 05b1b040c8
5 changed files with 296 additions and 116 deletions

View File

@@ -31,7 +31,7 @@ class notify
if(empty($this->notify_prefs))
{
$this->notify_prefs = e107::getConfig('notify')->getPref();
$this->notify_prefs = (array) e107::getConfig('notify')->getPref();
}
}
@@ -58,7 +58,7 @@ class notify
{
$include = null;
if ($status['class'] != e_UC_NOBODY) // 255;
if (varset($status['class']) != e_UC_NOBODY) // 255;
{
if(varset($status['include'])) // Plugin
{
@@ -150,7 +150,25 @@ class notify
$blockOriginator = FALSE; // TODO: set this using a pref
$recipients = array();
if ($notifyTarget == 'email') // Single email address - that can always go immediately
if(strpos($notifyTarget, '::') !== false) // custom router @see e107_plugins/_blank/e_notify.php
{
list($class,$method) = explode('::', $notifyTarget);
if($cls = e107::getAddon($class,'e_notify'))
{
$evData = [
'id' => $id,
'subject' => $subject,
'message' => $message,
'recipient' => varset($this->notify_prefs['event'][$id]['recipient'])
];
return e107::callMethod($cls, $method, $evData);
}
return false;
}
elseif ($notifyTarget == 'email') // Single email address - that can always go immediately
{
if (!$blockOriginator || ($this->notify_prefs['event'][$id]['email'] != USEREMAIL))
{