Developer Reference – Hooks, Filters & REST API

Action Hooks

Manually Trigger Notifications

Hook Arguments Description
PNFPB_trigger_post_notification_action $post_id, $title, $content, $url, $post_type Trigger a post notification from your own code.
PNFPB_trigger_activity_push_notification_action $content, $user_id, $activity_id Trigger a BuddyPress activity notification.

Background Cron Hooks

Hook Provider
PNFPB_httpv1_schedule_push_notification_hook Firebase HTTP v1
PNFPB_webpush_schedule_push_notification_hook WebPush
PNFPB_onesignal_schedule_push_notification_hook OneSignal
PNFPB_progressier_schedule_push_notification_hook Progressier
PNFPB_webtoapp_schedule_push_notification_hook Web-to-App
PNFPB_ondemand_schedule_push_notification_hook On-demand / one-time push
PNFPB_cron_generate_Firebase_oauth_token_hook Firebase OAuth token refresh (hourly)
PNFPB_cron_post_hook Scheduled post notifications
PNFPB_cron_buddypressactivities_hook Scheduled BP activity notifications
PNFPB_cron_buddypressgroupactivities_hook Scheduled BP group activity notifications
PNFPB_cron_buddypresscomments_hook Scheduled BP comments notifications
PNFPB_cron_comments_post_hook Scheduled post comments notifications
PNFPB_post_comments_notification_cron_hook Post comments (scheduled)
PNFPB_activities_comments_notification_cron_hook Activity comments (scheduled)
PNFPB_group_activity_notification_cron_hook Group activity (scheduled)
PNFPB_private_message_notification_cron_hook Private messages (scheduled)
PNFPB_new_member_notification_cron_hook New member (scheduled)
PNFPB_friendship_request_notification_cron_hook Friendship request (scheduled)
PNFPB_friendship_accept_notification_cron_hook Friendship accepted (scheduled)
PNFPB_avatar_change_notification_cron_hook Avatar change (scheduled)
PNFPB_cover_image_change_notification_cron_hook Cover image change (scheduled)
PNFPB_group_details_update_notification_cron_hook Group details update (scheduled)
PNFPB_group_invite_notification_cron_hook Group invitation (scheduled)
PNFPB_mark_as_favourite_notification_cron_hook Mark as favourite (scheduled)
PNFPB_bp_follower_notification_cron_hook BuddyPress follow (scheduled)
PNFPB_contact_form_notification_cron_hook Contact Form 7 (scheduled)
PNFPB_new_user_registration_notification_cron_hook New user registration (scheduled)

Filters

pnfpb_service_worker_extension

Allows other plugins to inject custom JavaScript into the PNFPB-generated service worker file. This is the standard integration point for combining PNFPB with other service worker-based plugins (e.g. cache plugins).

add_filter( 'pnfpb_service_worker_extension', function( string $sw_code ): string {
    $sw_code .= "n// My custom SW coden";
    return $sw_code;
} );

REST API Endpoints

The plugin registers WordPress REST API routes via rest_api_init for subscribing device tokens from mobile applications.

Method Route Description
POST /wp-json/pnfpb/v1/subscribe Register a device token from a native mobile app.
POST /wp-json/pnfpb/v1/unsubscribe Remove a device token.

See the plugin source file public/ajax_routines/ for exact parameter names and auth requirements.

Database Tables

Table Purpose
{prefix}pnfpb_ic_subscribed_deviceids_web All subscriber tokens (browser + device). Columns: id, userid, device_id, subscription_option, ip_address, web_auth, web_256, subscription_auth_token, firebase_version.
{prefix}pnfpb_ic_schedule_push_notifications On-demand / scheduled one-time notifications queue.
{prefix}pnfpb_ic_delivery_statistics_notifications Per-device delivery & open confirmation tracking.
{prefix}pnfpb_ic_total_statistics_notifications Aggregate totals per notification send.
Do not delete rows from {prefix}pnfpb_ic_subscribed_deviceids_web unless you are certain the token is invalid. Deleting a valid token means that subscriber will never receive another notification until they re-subscribe.