WP Subscribe To Comments

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”) :D
- 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. Blogging Pro - Blog News, Tools and Hacks Says:
    WordPress Plugins: Subscribe To Comments
    This plugin from scriptygoddess implements a comment subscription feature to your WP 1.2 installation. Subscribers will receive an e-mail when a comment is left on the topic they’ve subscribed to.

  2. Patrick Fitzgerald Says:

    Most excellent, works like a charm.

  3. seriocomic Says:

    I can’t get this to work. But I have comment moderation on. Do you know if that could stop the notification from being sent??

  4. Sara Says:

    Excellent plug-in Jenn! :) You are the Scripty Goddess for sure! Have a good weekend!

  5. Jennifer Says:

    seriocomic: Comment moderation should NOT affect the comment notification from being sent. Mind if I test yours out? Is there a test post I can hit with a few comments?

  6. Tek Says:

    Jennifer,

    It says that I am “forbidden” to download. *cries and feels left out from getting any candy*

  7. Tek Says:

    Okay, I went through a proxy to get the file but I could not get it before. =(

  8. Jennifer Says:

    I’m able to get the download to work fine from where I am. I know that my site has been having issues this morning… I think our server’s getting hit by a floodbot or something. Lovely. If anyone has any (continued) problems - email me: scripty AT scriptygoddess DOT com

    I’ll hook you up ;-)

  9. Code Novice Says:
    WP Comment Subscription Plugin
    Scriptygoddess' plugin is now available -- check her post for details and the download.

  10. seriocomic Says:

    Thanks Jennifer, you may try on any of the posts but the latest ‘updating’ one would be preferred…

  11. Jennifer Says:

    To those of you who are subscribed to comments - the post and download has been updated with a few bug fixes! :D

  12. seriocomic Says:

    Thanks for help wif getting it to work Jenn, you’re a legend. :)

  13. Romain Says:

    Great plugin… I haven’t had a chance to see it working so far. I looked into your subscribe-to-comments.php and realized you were missing the info TLD in the list of extensions on line 297.
    I was fighting against this plugin since last night. Maybe I found the reason why it wasn’t working for me…

  14. Mark J Says:

    There are a few others that are missing from that TLD list… good catch Romain.

  15. Jennifer Says:

    Yup - Actually Romain emailed me the fix for that and some good updates to the script… I just haven’t had time to implement them…
    Very soon.. I swear!!! :D

  16. Jennifer Says:

    Plugin updated to v 1.3

  17. Jason McIntosh Says:

    You realize, you’ve got GREAT timing. Just when I’m looking at implementing WP for all the users on my site, I find these wonderful plugins you’ve got, and even find you’ve posted an updated plugin the very evening I was looking for it ;) Thanks a mil!

  18. prem Says:

    Very good plugin, thank you. I hope this gets integrated with WP. =)

  19. Jennifer Says:

    Plugin updated to ver. 1.4

  20. Tek Says:

    Hey!

    Everything looks great! No errors… But I did a test to one of my dummy emails and the subscription doesn’t seem to be coming? It says I am subscribed yet I am not getting notification.

    Also, can you make a way for people to unsubscribe to a particular post if they want?

    Thank you. =)

  21. Jennifer Says:

    plugin updated to 1.4.1 - see changelog in post for details

  22. Mark J Says:

    Tek, make sure you test it by subscribing with a legitimate account, and then leaving another comment with ANOTHER account (this can be a dummy account). It is set NOT to e-mail you your own comments.

  23. Tek Says:

    Subscribe.

    Thanks Mark… I did do that. I have a plethora of dummy accounts. ;)

  24. Jennifer Says:

    Ack. Tek - did you add that text “subscribe” to your comment? I think I have a bug in my most recent code…grrr…Not going to be able to fix it until tonight too…

  25. Tek Says:

    Yes, I added that. And I just the comment you made sent to me by email. So it works. Just not sure why my site is being funny.

  26. Tek Says:

    Okay, I have found that you might get an error if you are using the blacklist from the weblogs tool collection here:

    http://weblogtoolscollection.com/archives/2004/05/24/wp-blacklist-12-released/

    I deactivated this plugin and now subscriptions are working for me.

  27. Jennifer Says:

    All issues fixed with that 1.4.1 from yesterday - New ver. is 1.4.2 (as always - please let me know if you run into any issues.) Script is still apparently not compatible with WP blacklist - but I should add that I’m not sure why you’d need that. WP’s built in Spam Words works great - as well - with Kitten’s Spam Words (which does NOT conflict with this script - I’m running that on this site) - I think you’re good to go.

  28. Mark J Says:

    This is just my generic response to “these two plugins conflict”:

    Try changing the priorities so that one is executed before the other, and then try it the other way around. Both these plugins have no priority set, which means they default to 10 (last). The one with the filename that comes first in the alphabet will get executed first.

    However, I have to second Jennifer’s (and Matt’s) puzzlement. A blacklist engine already exists in WordPress. They should work on improving that one.

    On a related note, are you going to release your blacklist, Jenn? Setting WP so that it moderates comments with 4 or more links has stopped all spam for me, and I’ve used the words in those spams to populate my blacklist, but you can never be too careful, eh?

  29. Jennifer Says:

    Actually my blacklist is published. Check the sidebar - last box - towards the bottom. I should note that not every entry is a 100% verified “spammer”. I’ve gotten at least two complaints/requests for removals of URLs - however, I only add to that blacklist unless I’m reasonably sure the comment was spam. So whether someone used those two URLs without the domain owner knowing - I don’t know. Either way - with WP, it doesn’t prevent someone from commenting - it’ll just put it in the queue. If it’s not really spam - then I push the comment through. So, regardless of the complaints - I’m still leaving those URLs there.

  30. Ria Says:

    Great plugin. Works like a charm! Thanks for putting it together.

  31. moods Says:

    It seems it doesn’t work on my blog…
    I uploaded everything; I changed the code in wp-comments.php; I added the code on functions.php; added the optional one.
    Then activated the plugin….

    Only after seen it didn’t work I modified wp-comments-popup… I thought it wasn’t necessary.
    But doesn’t work anyway.

    Any error I made?
    Bye
    Simone (Italy)

  32. Jennifer Says:

    Moods - the first thing I noticed right off the bat - you changed the checkbox code. You need to add it exactly as it was described in my post. You have it as:

    <input type=”checkbox” name=”subscribe” id=”subscribe” value=”avvisami“>

    That value MUST be “subscribe” as it is shown in the post. The Text between the LABEL tags you can customize…

  33. moods Says:

    Yes, now it’s ok.
    The error was because on installation and consequent customization I faulty meant that the subscription option was on a button, not in a checkbox….
    So i modified that code thinking to modify the label of the button.

    Sorry for boring… I learnt all the things i know about programming just doing “copy&paste”.
    Thank you :-)

  34. Jennifer Says:

    No apologies are neccessary. If you made the mistake - someone else might too. :) Glad it was an easy fix!

  35. moods Says:

    tank you :-)

    How to diplay the “blog author” item like in your comments?

  36. Jennifer Says:

    Right here

    Except - instead of wrapping the whole comment in a div - I just have an image next to the “comment author link” that’s wrapped with that: if($isByAuthor) code… I’ll post a comment in there later tonight with the exact code.

  37. Mark J Says:

    [edited by blog author: Mark moved his comments over here so we could stay on topic. :D ]

  38. moods Says:

    Mark j - I really try to do it myself: no problem in creating classes nor to understand the logic of your code but… i don’t know how to append it to the existing one…

    My code right now:

    <p><cite><?php comment_type();?><?php _e(”o di”); ?> <?php comment_author_link() ?> <?php if (comment_subscription_status()) { echo “(subscribed to comments)”; } ?> <a href=”#comment-<?php comment_ID() ?>”><?php comment_time() ?></a></cite> <?php edit_comment_link(__(”Edit This”), ‘ |’); ?></p>

    your code after I modified it for my WP:

    <?php
    if($comment->comment_author_email == ‘finto@finto.com’){ ?>
    <span class=”blogauthor”>
    <?php } else { ?>
    <span class=”comment-author”>
    <?php } ?>
    <?php comment_author_link(); ?></span>

    I tried several solution, but I really don’t manage how to fit them together…

  39. Tek Says:

    works great!! Wonderful!!

    Thanks =)

    I love this site! =)

  40. moods Says:

    I’m really proud of me cause it works!!!
    The problem I had with mark code was that the “notify on” icon was displayed in every comment, even those whose author didn’t subscribed.
    Thank you for the tip, which I used to enpower all my copying attitude :-)

    Here’s the new code shared

    <?php
    if($comment->comment_author_email == ‘finto@finto.com’){ ?>
    <span class=”blogauthor”>
    <?php } ?>
    </span><?php if (comment_subscription_status()) {?><span class=”comment-author”><? } ?></span>
    <a href=”#comment-<?php comment_ID() ?>”><?php comment_time() ?></a></cite> <?php edit_comment_link(__(”Edit This”), ‘ |’); ?></p>

  41. BB Says:

    I’m lost now with this “already-subscribed” code. Specifically, where in wp-comments.php does that go?

  42. Mark J Says:

    BB,
    The PHP function comment_subscription_status() returns TRUE if the author of the current comment being processed is subscribed to comments, and FALSE if he is not.

    Your use of this is entirely up to you, and you don’t have to use it if you don’t want. You would use it like this:

    <?php if(comment_subscription_status()) {?>
    THIS USER SUBSCRIBED
    <?php } else { ?>
    THIS USER NOT SUBSCRIBED
    <?php } ?>

    You could use it to set a different span class for the name of the author of the comment so that you could style it differently.

  43. Jennifer Says:

    BB - the code Mark is describing would go in the COMMENT LOOP - the loop that’s displaying the actual comments for your post - in wp-comments (or pop up comments, etc - whichever you’re using). (I think there was some confusion before - because there was some discussion of mixing the “show an icon if someone was subscribed” - with the “show an icon if the comment is by the blog author” code (originally posted about here)

  44. BB Says:

    What do I use to get both show an “icon if someone was subscribed” with the “show an icon if the comment is by the blog author”?

  45. Jennifer Says:

    Here you go:

    <?php foreach ($comments as $comment) { ?>
    <li>
    <!– I have the a tag below so you can permalink to specific comments –>
    <a name=”comment-<?php comment_ID() ?>”></a>
    <?php comment_text() ?>
    <p><cite><?php comment_type(); ?>
    <?php _e(”by”); ?>
    <?php comment_author_link() ?>
    <?php if ($comment->comment_author_email == ‘YOUREMAIL@example.com’) {
    echo “<img src=\”/images/author.gif\” width=\”64\” height=\”9\”>”;
    }
    ?>
    <?php if (comment_subscription_status()) {
    echo “<img src=\”/images/subscribed.gif\” width=\”63\” height=\”9\”>”;
    }
    ?>
    <?php comment_date() ?> &#8212; <?php comment_time() ?> | <a href=”#comment-<?php comment_ID() ?>”>permalink</a></cite> <?php edit_comment_link(__(”Edit This”), ‘ |’); ?></p>
    </li>
    <?php } // end for each comment ?>

  46. seriocomic Says:

    There is an error at line 121 in subscribe-to-comments.php of version 1.4.2

    I am also having issues with this plugin conflicting with Kitten’s ‘friendly comments’ plugin. With this (subscibe) plugin enabled it doesn’t work, with it disabled it does?!

  47. seriocomic Says:

    ok, its late, the error was me using a file viewer to view the uncompressed zip file and because I was using that code the conflict occurred…

  48. gravity Says:

    I was wondering if you could help me out with the following page. Where do I make changes so that this page:

    http://www.gravityworks.us/a.wpblog/wp-subscription-manager.php

    looks better?

    Any suggestion is appreciated.. is the the print.css or the wp-layout.css, since both are listed in the source.

  49. Mark J Says:

    I wouldn’t edit either of those, as those are the core WP interface CSS files. I’d either add another CSS link, or create an inline style sheet.

  50. BB Says:

    How about an unsubscribe to comments?

  51. Jennifer Says:

    BB - this is handled through the wp-subscription-manager.php. Subscribers get a link to the subscription manager in their notifications. There they can select which posts they want to unsubscribe from (or just unsubscribe from all) - or they can opt to be blocked from all emails from the site.

  52. gravity Says:

    Thanks Mark,

    I am just kinda interested to know why that page looks the way it does. Jennifer was able to nicely implement the subscribe option, but the unsubscribe section seems to have some issues.

    Does it look the same for everyone until it is customized? I have no problem writing it up, but I just want to make sure that it looks the way it does because of the way it was written and not because of an installation error on my part.

  53. Jennifer Says:

    When I was working on that page, Matt (photomatt.net) had asked that I use the stylesheet that comes with WP rather than creating another one, or an inline one. If you’ve customized the wp styles, then it will affect this page too. If you want it to look different/better - I would recommend creating a seperate stylesheet for that page.

  54. Mark J Says:

    It looks very plain. Here’s mine.

    I think Jennifer’s intention was for the more PHP/XHTML/CSS savvy bloggers to customize it to their liking. I still haven’t done so… but one of these days.

  55. Leonieke Says:

    great coding, Jennifer - thanks for all the effort :)

    seems I have a small database problem, b/c after adding the correct bits of coding, uploading the files, I get an error from the wp-admin/plugins.php file, saying it’s not allowed to open the plugin-file.
    do I need to chmod the file’s permissions?

  56. Leonieke Says:

    re: my previous comment - all seems to be working fine now - just chmod-d the plugin-file :)

  57. Marius Ooms Says:

    I changed the input line to be checked by default:

    <input type=”checkbox” name=”subscribe” id=”subscribe” value=”subscribe” CHECKED>

    Would this be the right way to have subscription on by default?

  58. Jennifer Says:

    Marius - that should work.

  59. Mark J Says:

    Marius, just keep in mind that if you are using XHTML, you will have to do this to be valid:

    <input type=”checkbox” name=”subscribe” id=”subscribe” value=”subscribe” checked=”checked” />

  60. Marius Says:

    Thank you…great script!

  61. Jeremy C. Wright Says:

    No idea if I’m being stupid here. I’ve just double checked that I’ve done everything right (great instructions btw).

    Everything’s uploaded to the right places. Everything’s CHMOD’d properly. Code is added to functions.php and wp-comments.php… And it’s just not working… No idea why. In fact, I’m not getting comment notifications to the topic now either…

    I’m sure this is me being stupid though :|

  62. Monty Says:

    I am sure i have read about this script somewhere but i cant find it on your site.

    Users should be able to edit their own comments for a certain time period after they have posted their comment. have you already made a hack for this?
    Cheers

  63. Mark J Says:

    I was the one who made that hack… for Movable Type. I’ve not yet had time to port it over to WordPress.

  64. Jennifer Says:

    Side note: Jeremy’s problem was a misunderstanding on how the script works. It will not email the subscription notice for your own comments :)

  65. Jeremy C. Wright Says:

    Yeah yeah, rub it in ;)

    But yes. User error!

  66. Charles Says:

    Well, I too am having trouble with this plugin. I installed everything, changed the code, and tested it by subscribing from one email and then posting again from a second email. The first email never received anything.

    I had the Blacklist plugin installed but uninstalled it by removing all the Blacklist files due to the incompatibility. Still doesn’t work.

    I am testing out WP alongside my MT blog so if someone wants to go in and check it out, I’d be very appreciative. The url is:

    http://www.rippleweb.org/index.php

    (note: need to use the index.php at the end since http://www.rippleweb.org is still pointed to my MT index.html). Thanks!

  67. Charles Says:

    Well, thanks totally to Jennifer — she figured it out! The Subscribe to Comments plugin and the “Optional Comment Moderation” plugin located here:

    http://theubergeeks.net/index.php?p=192

    are incompatible. At her suggestion, I turned off the optional comment moderation plugin and the subscription plugin works beautifully. Jennifer said she’d check out the optional comment moderation plugin and see if she can get them to play nicely together. :)

    Thanks, Jennifer!

  68. Jennifer Says:

    Plugin has been updated to ver 1.4.3 - just a minor bug fix. But with this bug fix, and a minor change to the Optional Comment Moderation plugin, they will work together. I’ll post more details shortly. (I sent my suggestion to Colin, so I’m just waiting to hear back from him)

  69. Jennifer Says:

    FYI - the optional comment moderation plugin has been updated. This latest version of wp-comment-subscription will play nice with the latest version of the comment moderation plugin.

  70. Prashant Says:

    This is a very useful plugin.

    I was wondering if there is an option to automatically subsrcibe each commentor to the post?

  71. Ninette Marie Says:

    Hallo friends! Really nice place here. I found a lot of interesting stuff all around. Just what I was looking for. Great joy!

  72. gravity Says:

    Added the subscribe option to this Blog. It did send an email to the admin. However, the subscriber did not receive the email informing them how to UNSUBSCRIBE. Is there more to it? Maybe I missed something?

    http://www.beachblog.net

  73. gravity Says:

    @everyone,

    Email was received by first subscriber indicating how to UNSUBSCRIBE. DO not worry about this or the last post. Thanks for such a nice script.

    Kind regards,
    gravity

  74. Trench Says:

    Is it possible to get this plugin to use SMTP instead of sendmail?

  75. CK Says:

    Uh oh… the functions.php is looking a little different….

    Here is line 919:

    wp_set_comment_status:
    part of otaku42’s comment moderation hack
    changes the status of a comment according to $comment_status.
    allowed values:
    hold : set comment_approve field to 0
    approve: set comment_approve field to 1
    delete : remove comment out of database

    returns true if change could be applied
    returns false on database error or invalid value for $comment_status*/

    function wp_set_comment_status($comment_id, $comment_status) {
    global $wpdb, $tablecomments;

    switch($comment_status) {
    case ‘hold’:
    $query = “UPDATE $tablecomments SET comment_approved=’0′ WHERE comment_ID=’$comment_id’ LIMIT 1″;
    break;
    case ‘approve’:
    $query = “UPDATE $tablecomments SET comment_approved=’1′ WHERE comment_ID=’$comment_id’ LIMIT 1″;
    break;
    case ‘delete’:
    $query = “DELETE FROM $tablecomments WHERE comment_ID=’$comment_id’ LIMIT 1″;
    break;
    default:
    return false;
    }

    if ($wpdb->query($query)) {
    return true;
    } else {
    return false;
    }
    }

  76. velkr0 Says:

    hey.. this plugin is great!! i couldn’t get it working at first.. and couldn’t figure it out.. but then i dawned on… permissions!! i had the permissions all whack, so I changed them.. and now its golden!! Thanks Jennifer!!

    oh.. just a question.. is there a way for the admin to see all the people that are subscribed? and to which posts?

  77. Stephen Says:

    I can’t seem to get this to work, well that is not true - everything works great except it does not send out the mail, where do I enter my mail server options??

  78. Jennifer Says:

    (worked with Stephen off line to resolve his issue) - but just another reminder: You will never be emailed your own comments. If you’re testing out the plugin, make sure you test using TWO SEPERATE email addresses. :)

  79. Jennifer Says:

    velkr0 - not at the present time. I will probably be updating/adding to this plugin to some degree once WP 1.3 is released. I’m kind of holding off for now. If it’s a feature that is widely needed, I will try to add it at that time.

  80. Ninette Marie Says:

    Just surfed in and found this really interesting place here. A lot of good stuff for everybody.
    Go on like this and i will surely visit your site again sometime.

  81. sushubh Says:

    errm… how do i upgrade to 1.2.1 without breaking this hack! are the 2 core files changed in the new update?

  82. Jennifer Says:

    1.2.1 replaces existing files. I would think that it won’t REMOVE files already existing in a directory. (If for some reason it did - you would need to upload the files again).

    After the upgrade - you’ll need to go through steps 3 and 4 from the instructions above again.

  83. Mark J Says:

    Jennifer,
    While it’s good that maybe_add_column is buried in an “if (!function exists())” conditional, it can still conflict with WP’s maybe_add_column(), which gets declared AFTER yours.

    This leads to “already declared function” errors when running update.php

    Maybe it’d just be better to rename it altogether: maybe_add_column_sg()

  84. Arnold Gamboa Says:

    Hey. I have installed the latest (v1.4.4). It seems though that I’m not successful in making it work. Can you do some testing here?

    http://arnoldgamboa.com/2004/10/johann-updates/#comments

    I’ve been testing the comments there.

    Thanks for the time.

    Arnold

  85. valerie Says:

    I’ve got a user that wants to be able to subscribe to comments without placing a comment first.
    Is this possible?
    I’ve looked to see if I can do it myself and I went huh. lol
    thanks

  86. Jennifer Says:

    When I was first developing the project, I had thought about doing that, but it required creating a seperate table in the database, which Matt had advised against. (I would imagine that would cause synchronization issues if you deleted a post, etc. plus, most of the time, you have people commenting - and that is when they want to be subscribed - and that way, you already have all their info from when they left a comment.)

    The workaround is the comments rss - or - just leave a comment. :)

    Alternatively (thinking “out loud” here) I guess you could set up a special “comment form” that, rather than a comment field, puts a special “code” as the “comment” for which you can look for when displaying your comments - and NOT display comments with that special “code”… Actually the more I think about it - I think that is the best way to do it… It will mean that feature becomes more of a hack, rather than a simple plugin, but at least it will do the job… stay tuned… ;-)

  87. Jean-Paul Says:

    Your subscribe-to-comments script is really quite nice, although I had a bit of a problem getting it to work, initially…

    I also use Brian Meidell’s nested comments plugin, and I found that at first the two weren’t playing nice (or at least I thought)… Your plugin didn’t work until I removed the “last few lines” from Brian’s PHP file (the ones that said were only necessary for the first run), wich included an add_action command that I thought might have conflicted with your plugin.

    In any event, great work!! Nice touch with the little “subscribed” images too.

  88. Jennifer Says:

    Jean-Paul - not sure which version of subscribe-to-comments you were using, but it was updated to work with that plugin. (However, admitedly, I haven’t tested that newer version he has out now for 1.3)

  89. velkr0 Says:

    love the plugin.. works great! except i just noticed something… when I goto the wp plugin page where you activate/deactivate… instead of the normal: name, version, author, etc… there is a whole bunch of CODE instead of the name, version, author, description, etc… did i delete/add something in subscribe-to-comments.php (when i was changing the email format) that would cause this? any ideas? how does wp get the info to create that plugin table?

  90. Jennifer Says:

    It sounds like you added another plugin that wasn’t in the right format. What was the last thing you added before you saw that? Whatever that plugin was that you added - try downloading it again (make sure you’re doing right-click, save-as)

  91. velkr0 Says:

    Jennifer, well i can’t remember what i added last so, i removed all the plugins, and uploaded a fresh copy of subscribe-to-comments.php and its still all messed up… but if i add any other plug in (such as post-count.php) it seems to create the table properly.. hmmm… i dunno… this is weird.. the code starts at different spots under each column.. for Plugins it starts “comments; $postid = (int) $postid; maybe_add_column”… Description starts right.. but continues to list author uri etc… any more ideas?

  92. aim Says:

    Great thing, but what I whant to suggest is to have just a button “subscribe to this post” without having to post a comment.

  93. Jennifer Says:

    I did look into this, but having someone subscribe to comments without posting a comment will become so much of a hack (and less of a simple plugin) that I’m not convinced it’s worth it. The problem comes in that if you want to avoid creating an extra table to store the registrations, then you have to do all sorts of hacks to have it not show up in your comments list - either in the total number of comments, or in the display, etc. Or if you do give up on that, and create an extra table - then you can potentially run into synchronization issues if you delete a post for example. As well - having the registrations stored in a seperate database makes it dificult to see who is registered and who is not. AND you’re checking two tables for registrations - one in the comments table - and one in your new subscribe to comments table.

    I keep going back to the original idea of “the more comments the merrier”. If you want to get notified of comments, leave a simple comment! Many bulletin boards have the same setup - where you can’t request to be emailed of new comments unless you have actually particpated.

    Another alternative is to subscribe to the RSS comments feed.

  94. aim Says:

    subscribtion to the comments rss feed is a good option, but rss readers is still some sort of exotic software in russia.

    :(

  95. Jennifer Says:

    What about something like bloglines?

  96. Mark J Says:

    Bloglines is definitely a great option. I use it, despite the plethora of great RSS readers from which to choose, because I love being able to log in and check my blogs from any computer with an internet connection.

    And I remember when you first wrote this plugin, I was trying to think of a way to allow users to subscribe without commenting… but there simply isn’t a way to do it without totally rewriting the code, and making in less efficient in the process, especially with regards to how the “Subcribed” code is shown.

    And hey, anything that encourages people to comment is good… if they care enough to know what others think on the topic, they probably have some thoughts of their own. :-D

  97. aim Says:

    hm… but it’s a great idea to create a plugin wich will let logged to the BL users to subscribe to the comment feed by pressing just one button…

    I will think on creating such thing…

  98. aim Says:

    btw, Mark J, your WP 1.3 theme is great! Do you have the same, but with left-handed menu? And do you share your theme with others?

  99. Mark J Says:

    Why thank you. Technically, it’s not a theme… it’s just hacked core WordPress files. But I guess it could be made into a theme. The only problem is that I use tons of plugins. Most of them are proprietary plugins I wrote myself.

    And honestly, I’m not too keen on seeing a bunch of sites identical to mine pop up. I started from scratch and have spent countless hours tweaking the design. While I’d be honored if people were inspired from it, and borrowed certain elements, I’m really not ready to encourage people to straight-up copy it.

    But once the themes engine in WP 1.3 has had some time to mature and I’m sure it is stable, I’ll likely be making some themes… and it’s likely that my themes will bear some resemblance to my site’s layout.

    If there is any specific aspect of my site that you’d like some insight into, I’ll be glad to share some of the “behind the scenes code.” Just drop me an e-mail.

  100. Rori Says:

    Thank you for this. You are so cool, I love your help.

  101. Lindsay Says:

    This is awesome! I’m installing the plugin on my Lindsay Lohan blog if you would like to check it out. It’s nice to see a kick butt woman programmer for once. ;)

  102. prem Says:

    I always get this error when I upgrade WordPress using the latest nightly builds:
    Fatal error: Cannot redeclare maybe_add_column() (previously declared in /home/premrara/public_html/wp-content/plugins/subscribe-to-comments.php:252) in /home/premrara/public_html/wp-admin/upgrade-functions.php on line 248

  103. Mark J Says:

    prem, scroll up to comment #81… you’ll have to disable the plugin while you upgrade or rename the maybe_add_column() function in the plugin.

  104. Seth Thomas Rasmussen Says:

    I am having this error when I enter an email address to check in the subscription-manager page:

    Database error: [Unknown column 'comment_subscribe' in 'where clause']

    I did everything as instructed, and nothing was mentioned about updating thedatabase. Do I have to have 1.2.1? I think I might still have 1.2…

  105. Jennifer Says:

    Have you left a comment subscribing to a post since installing the plugin?

  106. Seth Thomas Rasmussen Says:

    No… but my understanding is that “unknown column” means the column does not exist in the database.

  107. Jennifer Says:

    Correct. That column is added the first time someone leaves a comment subscribing to a post. Leave a test comment, subscribing to the post (you can delete it immediately), and that will create the column.

  108. Seth Thomas Rasmussen Says:

    Huh. That’s an odd way about it. Thanks, though.

    P.S. I subscribed to comments on this post, yet it still offers me the option to subscribe. Also, I don’t see a link to the subscription manager. That’d be handy, and a must for people that don’t know what page to access.

  109. Jennifer Says:

    Seth - your comments got all mangled up… could you please repost - also please make sure you convert any tags you’re pasting to ASCII!

    RE: Link to subscription manager - see (highlighted) comment #49.

    As for the b vs. strong and the missing tag, I’ll update that in the next revision of the script. However, I’m not sure what you were talking about it making the page not render. I’ve never seen that be a problem.

  110. Seth Thomas Rasmussen Says:

    Yeah, I forgot to encode < and >… as I said in one of the comments you deleted, I thought perhaps you could convert those for me. Sorry to sully your blog a bit there. ;)

    Regarding comment #49 here: I understand that as a general rule. I means specifically on your site here, I don’t see a link to the management page. I tried just adding “wp-subcription-manager.php” after the domain, but it said that wasn’t found. Also, on that note, though I’ve subscribed to comments on this post, it still offers me the chance to subscribe and doesn’t notify me that I already have. Just a detail I thought you might want to know about.

    As far as the page not rendering: user agents that support XML(i.e. Firefox) will stop rendering if the document is malformed. One way this can happen is mismatched tags. If the parser encounters a tag that doesn’t self terminate, <li> for instance, it will be expecting a </li> tag later.

    It broke my site because I am serving XHTML with an XML content-type to agents that signify with the http-accept header that they can accept it.

  111. Seth Thomas Rasmussen Says:

    Oh, and in the absence of re-writing my comment about the code stuffs, I’ll humbly direct anybody interested in more info on what I’m talking about to visit my post on the subject.

    Again though: great and indispensable plug-in. :)

  112. Jennifer Says:

    I don’t take away the option to subscribe to comments because I was following a usability “rule of thumb” to not remove options previously presented to users. Causing a “Sometimes it’s there - sometimes it’s not” effect (a usability “ewww” in my opinion) However, there’s nothing stopping you from doing so on your own blog - but there was never anything in the plugin that indicated that it would be done.

    As far as the link to “manage your subscriptions” - it’s in the EMAIL that you receive. The notification itself has a link at the bottom to manage your subscriptions. There really isn’t any need to include it on the comments form itself (it’s only useful IF you’re subscribing to comments) Again, there wasn’t an indication that it would be there through the plugin - But if you feel it needs to be there, you can add that link on your blog.

  113. Seth Thomas Rasmussen Says:

    While I can understand that rule of thumb you cite, it doesn’t really make any sense here. Subscribing to comments is like a toggle switch, and once you’ve toggled to one setting, you can only go back to the other from there. Leaving the subscription option is redundant and unecessary in this instance.

    The link in the email makes enough sense, but what if I want to unsubscribe to a thread that I haven’t recently received a message from?

  114. Mark J Says:

    Seth,

    You could display a (you are subscribed to this entry) message in place of the checkbox. I think you might have to make a new function, though. Basically, a function that grabs the e-mail address from the cookie (or from the global), and then does a “SELECT * FROM $tablecomments WHERE comment_post_ID=’$id’ AND comment_subscribe=’Y’ AND comment_author_email=’$email’ LIMIT 1″ to see if that e-mail address is currently subscribed to the current post.

  115. Seth Thomas Rasmussen Says:

    Mark J,
    It’s actually much simpler than that. As discussed on this entry here and in the above comments, there is a function included in the plugin that returns TRUE or FALSE depending on whether or not the stored email address is subscribed to that entry. My code looks like so:

    <?
    if (comment_subscription_status()) {
    echo ‘You are subscribed to comments on this entry. <a href=”/subscriptions/”>Unsubscribe?</a>’;
    } else { ?>
    <input type=”checkbox” name=”subscribe” id=”subscribe” value=”subscribe” />
    <label for=”subscribe”>Subscribe to comments (Email field must be filled in)</label>
    <? } ?>

  116. Mark J Says:

    I wrote that function, actually. And it is only appearing to work for you, in certain circumstances. Check out this entry: link

    I subscribed, and then deleted my cookie. It still says I am subscribed, and I’ll bet it will say that to everyone. The problem is that comment_subscription_status depends on being within the foreach($comments as $comment) loop. It appears to work, because $comment is left set, so if the last commenter subscribed, it’ll echo the message. I do like the idea, though, so when I get a second, I’ll whip up a function that’ll perform in all circumstances.

  117. Seth Thomas Rasmussen Says:

    “I wrote that function, actually.”

    Aha! What you say makes sense. Thanks for the heads up.

    This leads into a semi-related question: is there any sort of WordPress SDK-type resource out there?

    I look at WordPress and can imagine how I’d do most of it in ColdFusion, my primary SSL at the moment. I’m simply not savvy enough with PHP, much less WordPress’ implementation of it, to dive into some serious editing, plugin writing, etc.

    Anyways, I’ll see what I can do to include that code above within the comment loop for now. I’d love a shout out when you update that function.

  118. Seth Thomas Rasmussen Says:

    Okay, I thought I understood you before, but now I REALLY understand you AND Jennifer.

    I hadn’t paid close enough attention to what the comment_subscription_status() intended function. D’oh!

  119. Bjoern Says:

    I’ve got a strange bug over here - after I installed the hacks, everything seems fine, but WP isn’t sending *any* mails anymore, not even the standard notification mail that ought be send to me - anyone had similar problems?

    (I’m on WP1.2)

  120. Becky Says:

    Great plugin, Jennifer.. Thanks! I have a tiny problem:

    I’m running WP 1.2.2. It works fine updating for a subscription. However when I try unsubscribing to a particular post or all posts it doesn’t update the db and change Y to N. So the subscriber remains sub’d in.

    I’m willing to fiddle with things if you can give me some idea of what to fiddle with in the relevant unsub functions. ;)

  121. Becky Says:

    Oops! Ignore my post… I figured it out. In my quest to make it XHTML compliant I changed the both the label and input name; should not have changed the input name. (The validator balks at [] in

    Thanks again for a great little plugin, Jennifer!

  122. tabatha Says:

    I’ve installed the plugin exactly as directed, but it’s not sending out emails when someone posts… argh. anyone have any suggestions?

  123. Kelson Says:

    I finally got around to trying this out, but I had to fix a PHP issue in the code first.

    There are places in both files which open with <? instead of <?php — which works on some servers, but not all. If your host’s PHP is configured to disallow the shorter tag format, you will see gibberish in strange places, and some things will not work at all.

  124. Paul V Says:

    ok its all in…

    Not sure if I have my mail server set up right as wp does not even send me email when a new member joins

    any ideas?
    cheers
    Paul V

  125. Kevin Harris Says:

    Hello,

    Is there a way to automatically subscribe certain e-mail address (i.e. blog author/admin)?

  126. cw Says:

    I know this is a ridiculously easy question to ask, so i feel silly asking it, but how do i get the check box and the label to align to the left instead of being centered?

  127. eduardo Says:

    Hi, first of all thanks for the plugin, it is wonderfull, and for me it just makes a discussion forum superfluous.
    I got a little problem though: text encoding on my site is UTF-8, so the emails sent out have UTF-8 as their text enconding. Is there a way to have the emails encoded in ISO8859-1 (or whatever that number is)? Most people subscribing have little idea where the control for text encoding is burried in their emails programs and have difficulty reading the emails.
    Thanks!

  128. whoo Says:

    this is a great piece of code :) the only thing i would REALLY like to see in it is the ability to validate the e-mail addy like this example: http://www.php-scripts.com/php_diary/011103.php3

    I worry about people inputting email addys that they know are other people’s, in which case providing that someone actually click through a link to subscribe might be a better idea? especially on busier sites??

  129. Sven Rafferty Says:

    I just upgraded to WP 1.5 and when a comment if filled out, it no longer notifies the user or updates them as “Subcribed to Comment” on the comment page. Any ideas? The bit of code to add in 1.2 isn’t in functions.php anymore. Maybe 1.5 was a vast change from 1.3?

  130. Jennifer Says:

    Yes, it’s possible that the plugin needs to be updated for 1.5.

  131. Daisyhead Says:

    I believe the plug-in does need to be updated for WP1.5. I just tried to implement it and it’s not working. =(

  132. Sven Rafferty Says:

    Do you have any idea when you would be able to update your super-duper plug-in? I can’t live without it!! :)

  133. Sven Rafferty Says:

    Jennifer, I forgot to ask you. How do you format your comments to show every other in different colors? I like the box effect and the numbered list. I’d love to do this for my site!

  134. Jennifer Says: