PLEASE NOTE: Development of this plugin has (for some time now) been taken over by Mark – you can download the latest version from his site here
This plugin will allow your readers to get email notifications when comments are left on a post after their own. The install is very simple and does not modify any WP core code. As well, it's future-proofed to work, as is, with the next version of WordPress without your needing to upgrade the plugin.
Current Version: 1.5
(Support for 1.2 ends with v. 1.4.4 – still available here)
Last Updated: 3/10/04 9:53 PM EST
Here's the instructions (also included in a text file in the download):
1) Upload subscribe-to-comments.php to your wordpress plugins directory (this is in wp-content/plugins/ )
2) Upload wp-subscription-manager.php to the top level of your wordpress install directory (same directory wp-config.php is)
3) Add the following inside your comments form (between your <form> </form> tags) (in wp-comments.php and in wp-comments-popup.php):
<p>
<input type="checkbox" name="subscribe" id="subscribe" value="subscribe">
<label for="subscribe">Subscribe to comments (Email field must be filled in)</label>
</p>
3a)OPTIONAL
If you'd like to display on your comments if a particular commenter is subscribed to comments or not – you can use this function: comment_subscription_status() like this (customize for your own use)
<?php comment_text() ?>
<p><?php comment_type(); ?> <?php _e("by"); ?> <?php comment_author_link() ?>
<?php if (comment_subscription_status()) { echo "(subscribed to comments)"; } ?>
etc. etc. etc.
(this feature thanks to Mark)
4)There is a plugin hook missing in WordPress 1.2 (but it will be there in 1.3 – so you won't need to worry about making this change again when you upgrade. – But in order for this script to work in this version, you'll need to add this change manually)… In functions.php (in wp-includes folder) add the following line between lines 919 and 920:
do_action('wp_set_comment_status', $comment_id);
so the surrounding code will look like this:
if ($wpdb->query($query)) {
do_action('wp_set_comment_status', $comment_id); //THIS IS THE LINE YOU NEED TO ADD!
return true;
} else {
return false;
}
5) Activate the subscribe-to-comments plugin through the WordPress plugin admin page
You're done.
Change Log:
new in ver 1.5
MAJOR updates and bug fixes by Mark (who helps out so much around here I should name him "honorary scriptygoddess") 😀
– massive overhaul and cleanup. Manual database calls for checking to see if the do_not_email option existed and some manual update code. Replaced with add_option() and get_settings() calls.
– Changed $tablecomments and $tableposts and $tableoptions, etc. now exclusively using the $wpdb object. Note that this means that 1.2.x users are no longer supported.
– Fixed the "maybe_add_column" already exists error (renamed the function in the plugin)
– Fixed the error with the e-mail being blank for WP authors comments as was mentioned in the comments.
– Added/clarified comments
– now compatible with Spam Karma on WP 1.5 (latest version).
– Prevent notifications for Trackbacks and Pingbacks (change in WP 1.5 necessitated this)
new in ver 1.4.4
Bug fix/adujstment. Buried "maybe add column" function inside a check to make sure it doesn't already exist (in case someone else is using it in another plugin)
new in ver 1.4.3
Bug fix. Functions called with add_action now return variables passed to them.
new in ver 1.4.2
With Mark's help, modified add_comment_subscriber – so that if user had previously subscribed to comments – it will always add flags for that post (so that comment_subscription_status() will return true on all comments they leave after the user is subscribed to the post)
new in ver 1.4
Added comment_subscription_status() (thanks to Mark)
Fixed a few bugs with forward (ie WP 1.3) compatibility.
new in ver 1.3:
-international support and latest TLD's (update from Romain)
-Will no longer (ever) email commenters own comments (update from Mark)