=== AddonLogic Subscribe to Comments ===
Contributors: snehalpancholi
Tags: comments, subscribe, notifications, email, comment notifications
Requires at least: 6.0
Tested up to: 6.7
Stable tag: 1.0.0
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add a "notify me of new comments" checkbox that emails subscribers when approved comments are posted on any post.

== Description ==

AddonLogic Subscribe to Comments lets your readers opt into email notifications for new comments on posts they care about. A simple checkbox appears on the comment form. When ticked, the visitor is stored as a subscriber for that post. Every time a new comment is approved, all subscribers (except the commenter themselves) receive a beautifully formatted email notification with a direct link to the comment and a one-click unsubscribe link.

= Key Features =

* Opt-in checkbox on the WordPress comment form
* Emails all post subscribers when a new comment is approved
* One-click unsubscribe via a tokenised link in every email
* Customisable From Name, From Email, subject template and checkbox label
* Option to pre-check or leave unchecked by default
* Admin subscriber list (Comments > Subscribe to Comments > Subscribers)
* Paginated list with bulk-delete and single-delete actions
* Secure: random 32-char hex tokens, nonce-protected admin actions, sanitised inputs, escaped outputs
* Lightweight: no jQuery, no external dependencies
* Automatic updates from the AddonLogic update server

= How It Works =

1. A visitor leaves a comment and ticks the subscription checkbox.
2. Their email and post ID are stored in a custom database table.
3. When any new comment on that post is approved, all stored subscribers receive an email notification.
4. The email contains the commenter's name, a 200-character excerpt, a link to the comment, and an unsubscribe link.
5. Clicking the unsubscribe link immediately removes the subscriber and shows a confirmation page.

= Privacy Notes =

Subscriber emails are stored in your WordPress database. You are responsible for disclosing this data collection in your site's privacy policy. The plugin does not transmit subscriber data to any third party.

== Installation ==

1. Upload the `subscribe-to-comments` folder to `/wp-content/plugins/`.
2. Activate the plugin through **Plugins > Installed Plugins** in WordPress admin.
3. Go to **Comments > Subscribe to Comments** to configure settings.
4. The subscription checkbox will appear automatically on all post comment forms.

== Frequently Asked Questions ==

= Does this work with custom comment forms? =

Yes. The checkbox is added via the `comment_form_after_fields` and `comment_form_logged_in_after` action hooks, which most themes and plugins respect. If your theme uses a custom form that bypasses these hooks, you can call `addlc_stc_render_checkbox()` directly in your template.

= Can I change the email subject? =

Yes. Go to **Comments > Subscribe to Comments > Settings** and edit the Email Subject Template. Use `{post_title}` as a placeholder for the post title.

= What happens when a comment is deleted? =

Subscribers remain for the post. Only if the post itself is deleted (and the subscription token is removed) will the row disappear. You can manually delete subscribers from the Subscribers tab.

= Can a visitor subscribe without leaving a comment? =

No. The subscription is tied to the act of commenting, which ensures email addresses are verified through WordPress's comment flow.

= Is the unsubscribe link permanent? =

Each subscriber has a unique 32-character hex token. Clicking the unsubscribe link removes the row from the database. If someone tries to use the same link again it shows an "invalid link" message.

= Does this send emails for pending or spam comments? =

No. Email notifications are only triggered when a comment's status transitions to `approved`.

== Screenshots ==

1. Subscription checkbox on the front-end comment form.
2. Settings page (Comments > Subscribe to Comments > Settings).
3. Admin subscriber list with bulk-delete controls (Subscribers tab).
4. Notification email with comment excerpt and unsubscribe link.
5. Unsubscribe confirmation page.

== Changelog ==

= 1.0.0 =
* Initial release.
* Subscription checkbox on comment forms.
* Email notifications on comment approval.
* One-click unsubscribe with secure tokens.
* Admin settings and subscriber list.
* Bulk and single delete actions.
* AddonLogic auto-update support.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
