Onesignal send_after field
-
I have added a must use plugin with a hook into the onesignal plugin. everything works fine until I add the send_after field. This causes the notifications not to appear in the console. Here is my code:
add_filter(‘onesignal_send_notification’, ‘onesignal_send_notification_filter’, 10, 4);
function onesignal_send_notification_filter($fields, $new_status, $old_status, $post)
{date_default_timezone_set(‘UTC’);
$newTime = date(“M d Y H:i:s e+0000”,strtotime(date(“Y-m-d H:i:s”).”+2 minutes”));
$fields[‘send_after’] = (string)$newTime;$fields[‘isAndroid’] = true;
$fields[‘isIos’] = true;
$fields[‘isAnyWeb’] = false;
$fields[‘isChrome’] = false;
$fields[‘data’] = array(
“myappurl” => $fields[‘url’]
);
/* Unset the URL to prevent opening the browser when the notification is clicked */
unset($fields[‘url’]);
return $fields;
}
- The topic ‘Onesignal send_after field’ is closed to new replies.