=== Unread Message and Booking Reminders for HivePress ===
Contributors: wpdevstudio
Tags: hivepress, messages, bookings, email notifications, reminders
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Requires Plugins: hivepress
Stable tag: 1.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send scheduled email reminders for unread HivePress messages and pending HivePress bookings.

== Description ==

Unread Message and Booking Reminders for HivePress helps marketplace and booking websites follow up on conversations and booking requests that still require attention.

The plugin provides two independent reminder modules:

* Unread message reminders for recipients of HivePress messages.
* Pending booking reminders for owners of HivePress listings.

By default, reminders are scheduled after 2 days and 4 days. Before sending an email, the plugin checks the current message or booking state again. A reminder is skipped when the message has already been read or the booking has already been processed.

The plugin uses WordPress cron and the standard `wp_mail()` function. It does not connect to external services, collect analytics, or transmit site data to the plugin author.

This plugin is an independent add-on and is not developed, endorsed, or supported by HivePress.

= Features =

* Sends reminders for unread HivePress messages.
* Sends reminders to listing owners about pending booking requests.
* Uses default reminder intervals of 2 days and 4 days.
* Rechecks the current state before sending each reminder.
* Prevents duplicate reminders for the same item and interval.
* Reduces duplicate emails when multiple related items are processed together.
* Uses WordPress cron and standard WordPress email delivery.
* Provides filters for developers to customize intervals, URLs, email content, post types, and statuses.
* Does not use external APIs, tracking, telemetry, or license checks.

== Requirements ==

* WordPress 5.8 or later.
* PHP 7.4 or later.
* HivePress.
* HivePress Messages for message reminders.
* HivePress Bookings for booking reminders.
* Working WordPress email delivery.

== Installation ==

1. Upload the plugin ZIP through **Plugins > Add New > Upload Plugin**, or copy the plugin directory to `/wp-content/plugins/`.
2. Activate **Unread Message and Booking Reminders for HivePress**.
3. Make sure HivePress is active.
4. Activate HivePress Messages and/or HivePress Bookings for the reminder modules you need.
5. Verify that your website can send WordPress email.

No configuration screen is required. The default intervals are applied automatically.

== Frequently Asked Questions ==

= When are reminders sent? =

The default intervals are 2 days and 4 days after the original message or booking was created.

= Can I change the reminder intervals? =

Yes. Use the `hprp_reminder_minutes` filter. Values are expressed in minutes.

Example:

`add_filter( 'hprp_reminder_minutes', function () { return array( 1440, 4320 ); } );`

This example changes the intervals to 1 day and 3 days.

= Why are reminders not sent at the exact scheduled minute? =

The plugin uses WP-Cron. WP-Cron runs when the website receives traffic, so an event may run later than its scheduled time. Sites that need precise scheduling can configure a real server cron to trigger WordPress cron.

= Does the plugin send duplicate reminders? =

The plugin records completed reminder intervals and includes additional locking and grouping safeguards to reduce duplicate emails.

= Does it require both HivePress Messages and HivePress Bookings? =

No. HivePress itself is required. Each reminder module works only when the corresponding HivePress extension and data type are available.

= Does the plugin send data to an external service? =

No. It does not use external APIs, analytics, tracking, or telemetry. Emails are sent through the website using `wp_mail()`.

= Is this an official HivePress extension? =

No. It is an independent add-on for websites that use HivePress.

== Developer Notes ==

Default intervals are defined in minutes:

`const REMINDER_MINUTES = [2880, 5760];`

Available filters:

* `hprp_reminder_minutes`
* `hprp_unread_message_url`
* `hprp_pending_booking_url`
* `hprp_unread_message_reminder_subject`
* `hprp_unread_message_reminder_body`
* `hprp_pending_booking_reminder_subject`
* `hprp_pending_booking_reminder_body`
* `hprp_message_comment_types`
* `hprp_booking_post_types`
* `hprp_listing_post_types`
* `hprp_booking_declined_statuses`
* `hprp_booking_processed_statuses`

Available actions:

* `hprp_before_send_message_email`
* `hprp_before_send_booking_email`

== Privacy ==

The plugin does not collect, store, or transmit personal data to the plugin author or any external service. It processes existing WordPress, HivePress, message, booking, listing, and user data locally to determine whether a reminder should be sent. Email delivery is handled by the website through `wp_mail()` and may be affected by the site's mail or SMTP provider.

== Changelog ==

= 1.4.0 =
* Prepared the package for WordPress.org submission.
* Corrected the production reminder intervals to 2 days and 4 days.
* Removed development logging statements.
* Fixed the listing owner variable passed to the booking email action.
* Made default email content translatable.
* Improved plugin headers, documentation, privacy information, and developer notes.
* Updated compatibility information for WordPress 7.0.

= 1.3.5 =
* Fixed pending booking recipient detection so reminders are sent only to the listing owner.
* Removed the fallback to the booking author because the booking author is usually the requester.
* Added a safety check to skip sending when the resolved owner is the booking requester.

= 1.3.4 =
* Added grouped duplicate protection for booking and message reminders.
* Marked grouped duplicate items as processed for the relevant interval.

= 1.3.3 =
* Added stronger duplicate protection and booking reminder locking.
* Prevented delayed booking intervals from being sent together after WP-Cron catches up.

= 1.3.2 =
* Improved booking status detection.
* Improved reminder interval formatting.

= 1.3.1 =
* Added a WordPress.org-compatible readme file and plugin requirement headers.

= 1.3.0 =
* Added unread message reminders and pending booking reminders.
* Added duplicate protection and the initial 2-day and 4-day intervals.
