Push Notification for Post and BuddyPress (push-notification-for-post-and-buddypress) free WordPress plugin

This Plugin is designed to send push notification using Firebase Cloud Messaging whenever new WordPress post published, WordPress custom post types published and for new BuddyPress activities and also for comments posted in BuddyPress activities. It also generates PWA – Progressive Web App.
Plugin features:-
To send/schedule Push notifications when new item is published for following,
1.New post/custom post type published
2.New BuddyPress activities published
3.New BuddyPress group activity published
4.New Buddypress comments published
5.New BuddyPress message sent
Refer video tutorial under “How to use this plugin” section to configure Firebase options in plugin admin area.
To Generate Progressive Web App (PWA).Progressive Web Apps are supported by Chrome(Desktop,Mobile) browser, Edge browser, Firefox for android, Opera for android. Firefox for desktop will not support PWA. Admin options are in plugin settings page to enable/disable PWA app and to customize PWA app with app name, app icon, app theme color, background color and list of pages to be included in offline cache for web app offline mode.
To Opt for following different push notification use shortcode [subscribe_PNFPB_push_notification].The shortcode [subscribe_PNFPB_push_notification] is optional, it is a additional facility to subscribe to push notification for various following options inaddition to default option from browser.
1. Subscribe all notifications
2. Subscribe to all new post/new BuddyPress activity notifications
3. Subscribe to all new comments for post,BuddyPress activities notifications
4. Subscribe to new comments notifications only from My BuddyPress activities or My post based on Post Author id/BuddyPress activity Author id
5. Unsubscribe all notifications
It allows Scheduled Push notifications to send push notifications hourly(every hour), twice daily(2 times per day), daily, weekly as per WordPress CRON.
REST API to Integrate with Mobile app
It also provides REST API to integrate with mobile native app to get subscription token and to send push notifications to WordPress site users as well as to Native mobile app users
REST API url is https:///wp-json/PNFPBpush/v1/subscriptiontoken
Extra settings for NGINX server
If server is NGINX and not able to create dynamic service worker file https:///pnfpb_icpush_pwa_sw.js & PWA manifest json file https:///pnfpbmanifest.json then go to plugin settings->nginx tab, enable static file creation option, it will create required static service worker file, PWA manifest json files in root folder. This option is applicable only if hosting/server is based on NGINX and not creating dynamic service worker file, manifest json files. By default, this plugin creates dynamic service worker file and PWA manifest json file.
This plugin uses Firebase Cloud Messaging to send push notification using Firebase registration credentials which is free of cost.Firebase PUSH API is not compatible with Safari browsers and push notification using firebase push api will not work in Safari browsers. For Safari browsers,this plugin will display console log messages to indicate the browser is not supported for push api.This plugin automatically clears out device tokens which are not subscribed or if user unsubscribed from the browser then that token will be automatically deleted.Service workers are created on the fly for Firebase Cloud Messaging while activating the plugin
** Video tutorial showing how to configure Firebase for this plugin **
How to use Plugin:-
Following are steps to configure the plugin,
1. Download the plugin
2. Activate the plugin
3. Go to settings of the plugin (in admin menu -> Settings -> Push Notification PNFPB)
4. Enable/Disable push notification to all subscribed users when new post published,
5. Enable/Disable push notification to all subscribed users when new custom post types published,
6. Enable/Disable BuddyPress new activity push notification to all subscribed users,
7. Enable/Disable BuddyPress Group push notification for particular group members,
8. Enable/Disable BuddyPress message push notification only to particular user,
9. Enable/Disable BuddyPress new comment push notification to all subscribed users
- If schedule option is enabled then push notification will be sent according to selected schedule for above options,
Firebase configuration setup in plugin admin settings
- Sign in to Firebase, then open your project, click settings icon & select Project settings
To get Firebase server key (for field 1 in admin firebase settings)
- project settings > cloud messaging tab > get server key or add server key button to get server key
To get Firebase config fields (for fields 2 to 8 in admin firebase settings)
13.If you do not have web app, Create a new web app. After creating a new app, it will show firebase config fields
Project settings > General under your apps section > click on config button to view configuration fields
To get Firebase public key (for field 9 in admin firebase settings)
- Open the Cloud Messaging tab of the Firebase console Settings pane and scroll to the Web configuration section.
In the Web Push certificates tab, click Generate Key Pair. The console displays a notice that the key pair was generated, and displays the public key string and date added.
(If you already Generated key pair then no need to generate it again)
Progressive Web App (PWA) settings
-
Go to PWA settings in plugin admin area and fill all required fields to customize and generate PWA app with offline facility.If pages are included for offline cache then users will be able to view those pages in offline mode without internet if page is not stored in cache then default offline page will be displayed.if all urls needs to be excluded from offline PWA cache then enable exclude all urls option in PWA settings.
-
Once all required plugin settings are complete, it will ask to allow notification for this website in browser default popup, click on allow notification to get notifications
-
Push notifications will better work in normal browser not in cognito private browser as it requires service worker registrations to display push notification.
After completing above steps, push notification will be displayed based on option selected for posts/buddypress while publishing posts or custom post types or during new BuddyPress activities or comments.
-
New Shortcode [subscribe_PNFPB_push_notification] can also be used to display Subscribe/Unsubscribe push notification toggle button. It is a additional facility in addition to default option from browser to subscribe/unsubscribe push notifications. Following different push notification options are included in shortcode,
Subscribe all notifications
Subscribe to all new post/new BuddyPress activity notifications
Subscribe to all new comments for post,BuddyPress activities notifications
Subscribe to new comments notifications only from My BuddyPress activities or My post based on Post Author id/BuddyPress activity Author id
Unsubscribe all notifications -
Shortcode [PNFPB_PWA_PROMPT] to create button to install PWA. If user clicks this button, it will show default prompt to install PWA. This shortcode can be placed anywhere or in sidebar according to convenience.
-
Go to on-demand push notification admin panel to send push notification from admin panel to all subscribers whenever it required.
Author: Muralidharan Ramasamy
Plugin folder: push-notification-for-post-and-buddypress
Tags: desktop notification, mobile-notification, progressive web app, push notification, pwa



















