Firebase Push Notifications
Firebase Cloud Messaging integration for WordPress with push notifications support for messages, ad expiration, and ad deactivation.
by Vitaliy Karakushan · github.com/karakushan/firebase-push-notifications · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/karakushan/firebase-push-notifications/archive/refs/heads/main.zipFirebase Push Notifications WordPress Plugin
Description
Firebase Push Notifications plugin provides comprehensive Firebase Cloud Messaging integration for WordPress. It enables push notifications for various events including messages, ad expiration, and ad deactivation.
Features
- ✅ Firebase Cloud Messaging Integration
- ✅ Push Notifications for Messages
- ✅ Ad Expiration Notifications
- ✅ Ad Deactivation Notifications
- ✅ User Notification Preferences
- ✅ FCM Token Management
- ✅ Admin Dashboard
- ✅ Service Account JSON File Upload
- ✅ Comprehensive Diagnostics
- ✅ Multi-language Support
Installation
- Upload the plugin files to
/wp-content/plugins/firebase-push-notifications/ - Activate the plugin through the 'Plugins' screen in WordPress
- Go to Firebase Push → Configuration to set up Firebase
- Configure your Firebase project settings
Requirements
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Firebase project with Cloud Messaging enabled
- Service Account JSON file
Configuration
1. Firebase Setup
- Go to Firebase Console
- Create a new project or select existing one
- Enable Cloud Messaging
- Generate Service Account JSON
2. Plugin Configuration
- Go to Firebase Push → Configuration
- Enable Firebase Push Notifications
- Enter your Firebase Project ID
- Upload Service Account JSON file
- Configure VAPID key for web push
- Save settings
3. Testing
- Go to Firebase Push → Test Notifications
- Select a user with registered devices
- Send test notification
- Verify delivery
Usage
For Users
Users can manage their notification preferences in their dashboard:
- Enable/disable specific notification types
- View registered devices
- Delete device tokens
For Administrators
Administrators have access to:
- Firebase configuration
- Notification testing
- User device management
- Comprehensive diagnostics
API
Hooks
// Send notification to user
do_action('firebase_send_notification', $user_id, $title, $body, $data);
// Handle listing expiration
do_action('firebase_listing_expired', $listing_id);
// Handle listing deactivation
do_action('firebase_listing_deactivated', $listing_id);
Functions
// Get Firebase Manager instance
$firebase_manager = FirebaseManager::getInstance();
// Check if Firebase is initialized
if ($firebase_manager->isInitialized()) {
// Send notification
$firebase_manager->sendNotificationToUser($user_id, $title, $body);
}
File Structure
firebase-push-notifications/
├── firebase-push-notifications.php # Main plugin file
├── includes/
│ ├── class-firebase-manager.php # Firebase Manager
│ ├── class-notification-handler.php # Notification Handler
│ └── class-firebase-push-notifications.php # Main class
├── admin/
│ ├── firebase-config.php # Configuration page
│ ├── test-push-notifications.php # Test notifications
│ └── firebase-test.php # Diagnostics
├── assets/
│ ├── js/
│ │ ├── firebase-init.js # Firebase initialization
│ │ └── service-worker.js # Service Worker
│ └── css/
│ └── admin.css # Admin styles
├── vendor/ # Composer dependencies
└── composer.json # Composer configuration
Troubleshooting
Common Issues
-
Firebase not initialized
- Check Service Account JSON
- Verify Composer dependencies
- Check PHP error logs
-
Notifications not received
- Verify FCM tokens
- Check browser notification permissions
- Test with Firebase Console
-
Service Worker errors
- Check file paths
- Verify HTTPS connection
- Check browser console
Diagnostics
Use the built-in diagnostics tool:
- Go to Firebase Push → Configuration
- Click "🔍 Детальный тест Firebase"
- Review all test results
- Fix any issues found
Support
For support and bug reports, please visit:
- GitHub Issues: https://github.com/karakushan/Firebase-Push-Notifications
Changelog
1.0.0
- Initial release
- Firebase Cloud Messaging integration
- Push notifications for messages, ads
- Admin dashboard
- Service Account JSON upload
- Comprehensive diagnostics
License
This plugin is licensed under the GPL v2 or later.
Credits
- Firebase PHP SDK by Kreait
- Firebase JavaScript SDK by Google
- WordPress Plugin API