You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently e107 only provides options for emailing of notifications, but not SMS, Push notifications or similar.
Proposed Solution
Allow plugins to expand the core functionality to provide additional notification channels via new methods inside e_notify.php.
Example
class _blank_notify extends notify
{
function config()
{
$config = array();
$config[] = array(
'name' => "Notify about something",
'function' => "customNotify",
'category' => ''
);
return $config;
}
function customNotify($data)
{
$subject = "My Notification";
$message = print_a($data,true);
$this->send('customNotify', $subject, $message);
}
// BELOW IS OPTIONAL - R IF YOU WISH YOUR PLUGIN TO BECOME A ROUTER OF NOTIFICATIONS. eg. sending sms or messages to other platforms.
/**
* REMOVE THIS METHOD WHEN NOT IN USE.
* @return array
*/
function router()
{
$ret = [];
$ret['other_type'] = array( // 'other_type' method will be called when this notification is triggered (see method below)
'label' => "Blank Example", // label used in admin Notify area
'field' => "handle", // rendered in the admin Notify area when this option is selected. see method below.
'category' => ''
);
return $ret;
}
/**
* Custom method used to render a field in Admin Notify area.
* REMOVE THIS METHOD WHEN NOT IN USE.
* @param string $name Field name.
* @param mixed $curVal current value.
* @return string
*/
function handle($name, $curVal)
{
return e107::getForm()->text($name, $curVal, 80, ['size'=>'large','placeholder'=>'eg. account name']);
}
/**
* Custom Method to handle notification.
* REMOVE THIS METHOD WHEN NOT IN USE
* @param array $data
* @return array
*/
function other_type($data)
{
return $data; // Peform some other kind of notification and return true on success / false on error.
}
}
Example Output in admin area:
Other usage example:
Saving a phone number to receive SMS notifications. (See Twilio plugin )
The text was updated successfully, but these errors were encountered:
Motivation
Currently e107 only provides options for emailing of notifications, but not SMS, Push notifications or similar.
Proposed Solution
Allow plugins to expand the core functionality to provide additional notification channels via new methods inside e_notify.php.
Example
Example Output in admin area:
Other usage example:
Saving a phone number to receive SMS notifications. (See Twilio plugin )
The text was updated successfully, but these errors were encountered: