Frontend Subscription Settings

PNFPB provides a flexible front-end subscription UI so visitors can choose exactly which notification types they want to receive.

Subscribe / Unsubscribe Button

When Firebase credentials are configured and the service worker is active, PNFPB automatically adds a floating Subscribe / Unsubscribe button to your site’s frontend. The button is rendered by the React-based build script (build/pnfpb_push_notification/index.js).

Button behaviour:

  • First visit: shows a custom push prompt (if enabled) asking the user to allow notifications.
  • After browser permission is granted: stores the device token in the database.
  • Toggle: clicking “Unsubscribe” removes the device token and unregisters the service worker subscription.

Notification Preference Panel

Logged-in users can select which notification types they want (e.g. only post, only activity, or all). The list shown is controlled by the pnfpb_show_push_notify_types setting. Available types:

  • all – all subscriptions
  • post – new post
  • activity – BuddyPress activities
  • all_comments / my_comments
  • private_message
  • new_member
  • friendship_request / friendship_accepted
  • avatar_change / cover_image
  • group_details / group_invite

Restrict to Logged-In Users

Enable the “Notify logged-in users only” setting (pnfpb_ic_fcm_loggedin_notify) to skip the subscription prompt for guests.

Button Customisation

Configure under PNFPB → Customize buttons:

Setting Default
Subscribe button text Subscribe push notification
Unsubscribe button text Unsubscribe push notification
Subscribe button background color #000000
Subscribe button text color #ffffff
Subscribe confirmation message Subscription updated
Unsubscribe confirmation message Your device is unsubscribed from notification
Close button text Close
Save button text Save
Cancel button text Cancel

Custom Push Prompt

PNFPB replaces the browser’s native push permission prompt with a custom branded dialog. Configure under PNFPB → Custom push prompt:

  • Prompt text
  • Yes / No button text
  • Button background & text colors
  • Dialog background color & text color
  • Prompt position (top-left, top-right, bottom-left, bottom-right)
  • Show again after N days if dismissed (pnfpb_ic_fcm_custom_prompt_show_again_days, default 7)
  • Desktop only / Mobile only / Pixel-based trigger options
  • Confirmation message on/off after subscribing