=== Simple BuddyPress Notifications ===
Contributors: imemine
Tags: buddypress, buddypress notifications, forum, notification
Requires at least: 4.6
Tested up to: 7.1.2
Requires PHP: 5.6
Stable tag: 2.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Simple BuddyPress Notifications allows sites using BuddyPress to have a notification icon on the site. It also plays a "ting" sound when a new notification arrives.

== Description ==

Simple BuddyPress Notifications replaces the default BuddyPress notification icon with a custom bell icon that also plays a sound when new notifications are received. It shows the number of unread notifications and plays a ting sound for new notifications.

This plugin works in two modes: 
1. **Live Notifications**: Notifications will be updated in real-time with audio and visual alerts when the user is logged in.
2. **Offline Notifications**: When the user is offline, the plugin will still show the number of unread notifications.

Use the shortcode `[simple_buddypress_notifications]` to display the notifications icon anywhere on your site.

Notification audio attribution: [https://github.com/akx/Notifications](https://github.com/akx/Notifications)

== Features ==

- Custom notification icon and sound
- Real-time notifications with sound alerts
- Easy to integrate with shortcodes
- Works with BuddyPress Notifications API
- Lightweight and simple setup

== Installation ==

This section describes how to install the plugin and get it working.

1. **Upload** `Simple BuddyPress Notifications` to the `/wp-content/plugins/` directory.
2. **Activate** the plugin through the ‘Plugins’ menu in WordPress.
3. **Place the shortcode** `[simple_buddypress_notifications]` wherever you want to display the notification bell.

== Frequently Asked Questions ==

= How do I add the notification icon to my site? =

Use the shortcode `[simple_buddypress_notifications]` wherever you want to display the notification icon. This can be placed in any post, page, or widget.

= Can I change the notification sound? =

Currently, the sound is fixed as "Jinja.mp3". You can replace the audio file in the plugin directory with your own sound if desired.

= Why isn't the sound playing? =

Ensure that your browser supports autoplay for audio files, and check that JavaScript is enabled in your browser.

= Does this work with all BuddyPress components? =

Yes, as long as the BuddyPress Notifications component is active, the plugin will work with all registered BuddyPress notifications.

== Changelog ==

= 2.0.1 =
* Fix: Resolved PHP 8 TypeError bug in Heartbeat notification ID comparison.
* Fix: Fixed JavaScript undefined `jq` error and wrapped scripts in standard jQuery enclosure.
* Performance: Removed aggressive global 5-second Heartbeat override to avoid excessive server requests.
* Performance: Optimized asset enqueuing so heavy fonts, styles, scripts, and audio are not loaded for logged-out visitors.
* Performance: Added preload="none" attribute to notification audio element to defer MP3 download until needed.
* Compatibility: Migrated notification queries to native BuddyPress APIs (BP_Notifications_Notification::get).
* Compatibility: Avoided hardcoded plugin file assumptions to support BuddyPress-compatible environments.

= 2.0 =
* Updated code for better BuddyPress integration.
* Fixed notification sound issues and ensured compatibility with modern browsers.
* Added support for real-time notifications with heartbeat.
* Improved CSS and JS for better performance.

= 1.3 =
* Initial release with BuddyPress notification support and sound feature.

== Upgrade Notice ==
* Update to 2.0.1 for bug fixes, performance improvements, and PHP 8 compatibility.