Cancel an email notification (for example to exclude some users)

The Notifications add-on automatically send notifications to appropriate users on certain events. For some reason, you may want to not send some of those notifications.

The filter 'cuar/notifications/content' is there for you. If you return false in that filter, the notification will not be sent to the given recipient.

Here is for example how you could avoid sending any notification to user with ID 3.

add_filter('cuar/notifications/content', 'custom_cuar_cancel_notification', 10, 5);

function custom_cuar_cancel_notification($content, 
                                  $recipient_id,
                                  $notification_id,
                                  $post_id,
                                  $extra) 
{
    if ($recipiend_id == 3) return false;

    return $content;
}