Skip to content

Commit

Permalink
Add new filter to abort/prevent notification based on notification or…
Browse files Browse the repository at this point in the history
… post id/data #1723
  • Loading branch information
olatechpro committed Aug 2, 2024
1 parent 46269bf commit 60b122e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/async-notifications/async-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,18 @@ public function upgrade($previous_version)
*/
public function send_notification($params)
{
if (!is_array($params)) {
return;
}

// Work the notification
$workflow = Workflow::load_by_id((int)$params['workflow_id']);
$workflow->event_args = $params['event_args'];

if (!apply_filters('publishpress_notifications_send_notification', true, $workflow)) {
return;
}

do_action('publishpress_notifications_send_notifications_action', $workflow, true);

do_action('publishpress_notifications_async_notification_sent', $params);
Expand Down Expand Up @@ -194,6 +202,10 @@ public function filterDebugInformation($debugInfo)

public function schedule_notifications($workflow)
{
if (!apply_filters('publishpress_notifications_schedule_notification', true, $workflow)) {
return;
}

$scheduler = $this->get_service('notification_scheduler');

$scheduler->scheduleNotification($workflow->workflow_post->ID, $workflow->event_args);
Expand Down

0 comments on commit 60b122e

Please sign in to comment.