scriptygoddess

03 Jun, 2004

WP Subscribe To Comments

Posted by: Jennifer In: WordPress Plugins

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.

Here's the download

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)

175 Responses to "WP Subscribe To Comments"

1 | eduardo

March 11th, 2005 at 8:43 am

Avatar

Yes! It is working for me now – i got Chris' comment above. Thanks, Jenn!

2 | Idyllopus

March 11th, 2005 at 9:29 am

Avatar

Indeed, am getting notifications now. The first one for me to get was Jennifer's last post of 3/11 at 8:23 am.

Thanks! Looking forward to using the plug-in!

3 | Alex

March 11th, 2005 at 12:56 pm

Avatar

Your plugin is very useful. Here's two suggestions:
– it's confusing enough to be worth mentioning in the docs: in WP 1.5, the wp-comments.php and wp-comments-popup.php have been moved to wp-content/themes/<themename>, so you have to edit them for each theme
– it could be useful to show users who are already logged in that they are subscribed to comments (i.e. as opposed to only showing them that people who have already posted comments are subscribed); just drop the code given for the latter in the right place.

4 | Mark J

March 11th, 2005 at 3:54 pm

Avatar

Good points, Alex. I'm likely going to update the plugin once WordPress 1.5.1 is out. Here are some of the things I'd like to do:
– Have an admin page where the admin can view or modify subscriptions or blocks.
– Hide the "subscribe to comments" checkbox if the user is already subscribed to that post and maybe replace with a "unsubscribe me from this post" link.
– Insert the "subscribe to comments" code automatically in WordPress 1.5 using comment_form hook.
– Simplify the "subscribe to comments" code for people who want to or have to manually place it by reducing it to a function.
– Add e-mail verification for anyone who chooses to block all notification e-mails. I think it is too easy for someone to be confused and enter their e-mail there and be instantly blocked forever. This way they will get a confirmation e-mail that they will use to click a special link that will block their address.

Let me know if you can think of any other useful things and I'll try to work them in to the next version.

5 | eduardo

March 14th, 2005 at 11:57 am

Avatar

I feel the need for a better subscriber interface, that is, someone subscribing to a few posts needs a simple way to change their email, other than posting comments to all posts. A subscriber to my blog requested this, and i had to change his email manually in WP's dbase.

6 | Mark J

March 14th, 2005 at 2:37 pm

Avatar

eduardo, excellent idea. I'm also thinking about adding a layer of security before someone can unsubscribe to a post as well. Basically, in the notification e-mails, there will be a special link that contains an MD5ed hash of the users e-mail address plus an unknown seed, such as the WP database password. That way we know that pranksters aren't changing people's e-mail addresses or blocking them from receiving subscriptions. Using this, we could verify a commenter's identity, and allow them to do something like globally change their e-mail address, or block further notifications for their e-mail address.

7 | eduardo

March 14th, 2005 at 10:09 pm

Avatar

Yes, that would be nice!
Also, i was wondering if there is the need for double opt-in, or if this would only be a hassle to readers. My site is not high-traffic at all, but there are quite a few subscribers, and i never had a complaint about unsolicited email from the site, so i'm not sure if the double opt-in wouldn't just bug people and keep them from subscribing. Thoughts?

8 | Mark J

March 14th, 2005 at 11:35 pm

Avatar

eduardo, I also considered double opt-in, but decided it was too much of a hassle. There is no need for opt-in if we have opt-out, and I think having opt-in is more of a hassle than having opt-out, and doesn't really stop the problem of possible unsolicited e-mail. I mean, they'd still get the opt-in e-mail.

I did some work on the plugin, adding conditional code to hide the "subscribe to comments" checkbox if the current viewer is subscribed or is the post author, and in that case it will be replaced with "You are subscribed to this entry. Manage your subscriptions." with a link to the subscription manager. I'll continue to work on it and will likely release another version after WP 1.5.1 comes out.

9 | eduardo

March 15th, 2005 at 11:12 pm

Avatar

I agree with you, Mark. And these last improvements you described will make the script more user friendly too, i think. Nice work!

10 | Mark J

March 16th, 2005 at 3:05 am

Avatar

Eduardo, Jennifer, Alex, and everyone else:

I've documented some of the changes I've made so far, and would like feedback as well as additional suggestions.

11 | Ajay

March 16th, 2005 at 7:23 am

Avatar

How do I edit/delete email addresses in the subscription list as an author?

12 | Jennifer

March 16th, 2005 at 8:35 am

Avatar

Technically – you could just pull up the wp-subscription-manager.php page and enter in the user's email address. From there you can manage that person's subscriptions….

13 | Tom Raftery

March 16th, 2005 at 1:28 pm

Avatar

Scriptygoddess,

First off, thanks for this plug-in, I love it.

One small quibble – there is an error in the code which causes w3c validation errors – I thought you should be aware of it.

Your line:
<input type="checkbox" name="subscribe" id="subscribe" value="subscribe">

Should be:
<input type="checkbox" name="subscribe" id="subscribe" value="subscribe" />

Thanks again,

Tom

14 | Ajay DSouza

March 17th, 2005 at 10:27 am

Avatar

Thanks Jennifer.

I am now waiting for Matt's version 2.0.
It looks good, hoping he releases a beta 😀

15 | Daisyhead

March 18th, 2005 at 10:41 pm

Avatar

Quick question. I've tried testing this on my site, but it doesn't seem to work for me. Can someone explain exactly how the script works?

You check the "subscribe to comments" box and then anytime someone OTHER than yourself comments, you get an email?

Maybe the problem is that I'm testing it and since I'm the admin on my blog, it's not emailing me?

16 | Daisyhead

March 18th, 2005 at 11:10 pm

Avatar

Eh, scratch that previous comment. I got it all figured out. D'oh! 😉

17 | LcF

March 24th, 2005 at 11:35 pm

Avatar

I am using version 1.4.4 on WP1.2. I cannot see the Admin control of wp-subscription-manager.php, even I have log in WP admin panel. Any idea?

18 | prem

March 25th, 2005 at 6:40 pm

Avatar

Did you place wp-subscription-manager.php in the directory (where you can see the folders wp-admin, wp-includes, wp-content)?

Did you run http://your_address_to_wp.com/wp-subscription-manager.php

19 | LcF

March 25th, 2005 at 10:02 pm

Avatar

Yes, I did. The subscribe to comment runs fine. Visitor can subscribe and unsubscribe to comments. The only problem is that I cannot view the Admin control, even I have just login WP admin panel.

21 | Jennifer

March 29th, 2005 at 3:21 pm

Avatar

LcF – I think there's some confusion about what you might be thinking is an "admin" control for this plugin. The link that Mark gave you *IS* the only "Admin" control there is. From there, you enter in an email address of somone that is subscribed to posts on your site. Then you (or they) can elect to be removed from any subsciptions.

The only further "admin" control is that if the person elected to be blocked from all emails from your site – you, as a logged in admin, after entering in their email address, can unblock them.

That's pretty much it. What other features are you missing?

22 | LcF

March 29th, 2005 at 3:32 pm

Avatar

oic… Thank you for the explaination! Confusion solved. :)

23 | Mac

March 30th, 2005 at 5:43 pm

Avatar

2 issues I am having with this plugin.

1.) even though I am logged out, it still displays that I am subscribed to the post.

2.) Windows IIS servers will not recognize the wp-subscription-manager.php filename … so I renamed it to wp_subscription_manager and changed your code to match, which that works, but now I get a

Fatal error: Call to undefined function: sg_subscribe_start() in D:\hshome\qpconlin\blog.qpconline.com\wp_subscription_manager.php on line 12

error when trying to access the subscription manager…..

what gives?

24 | Mark J

March 30th, 2005 at 6:23 pm

Avatar

You're using the alpha version of Subscribe to Comments 2.0.

You appear to be subscribed to the post because you have either a comment cookie with a subscribed e-mail, or you are signed in as the post author. I just visited your site, and I wasn't shown as being subscribed.

The problem wtih undefined sg_subscribe_start(); is because you renamed the wp-subscription-manager.php file. You'll have to change line 8 to match. What is IIS's problem with the filename? It seems to me that if that doesn't work, WordPress wouldn't work.

Please take any further questions over to this entry on my site.

25 | Jennifer

March 31st, 2005 at 8:31 am

Avatar

I'm going to shut down comments on this thread now in the hopes that it will minimize confusion. Mark has taken on development of this plugin here. Once that version is officially released, support for this (older version) plugin will be minimal.

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements