=== HiRizzi Notifications ===
Plugin Name:  HiRizzi Notifications
Version:      0.1.2
Author:       HiRizzi
Author URI:   https://hirizzi.com
Plugin URI:   https://hirizzi.com/free-downloads/
License:      GPL v2 or later
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
Requires WP:  5.3
Tested up to: 6.7
Requires PHP: 7.4

== Description ==

A drop-in email notification layer for membership, dating, and messaging sites built on WordPress. Any theme or plugin can trigger a branded HTML notification email with one line of code — HiRizzi Notifications handles per-sender rate limiting, noreply routing, and a secure link back to the relevant conversation.

This is v0.1.1 — an initial developer-facing release. It does not detect messages on its own; it's the notification layer other code calls into. See "Developer Integration" below.

= Core Features =

* One public hook: `do_action( 'hiznotify_send', $args )` — works with any custom messaging system, not tied to a specific membership plugin
* Editable HTML email template with placeholders (sender, message preview, conversation link, branding)
* Per (recipient, sender, notification type) rate limiting — configurable minutes between emails, atomic against concurrent triggers
* Noreply From/Reply-To header configuration, independent of the site's default WordPress email identity
* Secure deep-links: clicking the email link always requires a real login as the intended recipient before redirecting to the destination. There is no auto-login from the email link — this is a deliberate security choice, not an oversight.
* Content-Type is set per-message, not via a global filter, so it never affects unrelated site emails (password resets, comment notifications, etc.)

= How It Works =

1. Your messaging system (or any code) fires:

```
do_action( 'hiznotify_send', array(
    'recipient_id'     => $recipient_user_id,
    'sender_id'        => $sender_user_id,      // 0 if not applicable
    'type'             => 'message',            // any string; buckets the rate limit
    'sender_name'      => $sender_display_name,
    'message_preview'  => $short_text_preview,
    'destination_url'  => $conversation_url,    // where the deep-link should send them
) );
```

2. HiRizzi Notifications checks the rate limit for that (recipient, sender, type) triple. If a notification was already sent within the configured window, it silently skips — this is expected behavior, not an error.
3. If allowed, it generates a signed, expiring deep-link token bound to the recipient's user ID and the destination URL, renders the HTML template, and sends the email via `wp_mail()`.
4. When the recipient clicks the link: if they're not logged in, they're sent to the normal WordPress login screen and returned to the same link afterward. If they're logged in as a different account, the link is refused. Only once they're authenticated as the correct recipient are they redirected to the destination URL.

== Installation ==

1. Upload and activate the plugin like any other WordPress plugin.
2. Go to Settings → HiRizzi Notifications and configure your From name/email, Reply-To, rate limit window, deep-link expiry, brand color, and logo.
3. Wire the `hiznotify_send` action into wherever your site creates a new message/match/event.

== Frequently Asked Questions ==

= Does this detect new messages automatically? =
No. It's a notification-sending layer, not a messaging system. Your existing messaging code (custom, BuddyPress, bbPress, or anything else) calls `do_action( 'hiznotify_send', ... )` when something notification-worthy happens.

= Why doesn't the email link log me in automatically? =
Auto-login links are a real security risk — if the email is ever forwarded, appears in a referrer header, or the inbox itself is compromised, whoever has the link gets into the account with zero further verification. This plugin always requires a genuine login as the correct recipient first.

= Can I use more than one notification type? =
Yes. The `type` parameter is a free-form string used only to bucket rate limiting — e.g. `message`, `match`, `profile_view` are all independently rate-limited per sender/recipient pair.

= Does this work with BuddyPress or bbPress? =
Not out of the box in this version — you'd add a small snippet calling `do_action('hiznotify_send', ...)` from their respective message/notification hooks. A dedicated integration may be added in a future version.

== Changelog ==

= 0.1.2 =
* Added a review-request banner at the top of the settings page.

= 0.1.1 =
* Deep-link tokens are now atomically single-use rather than reusable until expiry.
* Failed wp_mail() attempts release their exact rate-limit reservation so a delivery failure does not suppress retries.
* Added stricter deep-link token validation and database-insert failure handling.

= 0.1.0 =
* Initial release: public `hiznotify_send` hook, editable HTML template, per-sender rate limiting with atomic concurrency guard, noreply/reply-to header configuration, and secure (no-auto-login) deep-link tokens.
