Support » Plugin: Comment Reply Email Notification » Unsubscribed when no email given

  • I’m loving this plugin so far. It’s straightforward—a single checkbox—which is nice. However, my site doesn’t require commenters to leave an email at all (privacy thing). I’m trying to figure out how that works with this plugin.

    I’m looking at the plugin’s source, and it never checks whether the email isn’t blank before sending out the notification. It seems it comes down to PHPEmail->send() to fail if no email was given, but the subscribe button was checked by default. I tried it. It doesn’t seem to fail, but I guess I probably got a bad delivery attempt on my server.

    It would be super cool if, as an alternative to the checkbox, the commenters subscribed by providing their email, or opt out by not supplying it. The checkbox wouldn’t need to be present at all. Seems logical to me, and one less UX complication.

    Otherwise, this plugin is pretty much exactly what I was looking for to correct Vanilla WordPress’s baffling default behavior (asking for email addresses, but not doing anything with them). I’ll definitely be using the plugin even if this small suggestion doesn’t pan out.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author guhemama


    Thanks for your comment – I am glad you like it. I believe you could achieve something similar with hooks… The plugin is actually pretty simple and you probably could have something like it. 🙂

    The source code is available here:

    Right, yeah. I’ve seen the source.

    It looks like what I’m describing could be easily accomplished by adding the following:

    // Remove the subscribe checkbox for non-logged in users.
    remove_filter('comment_form_default_fields', 'cren_comment_fields');
    // Remove the existing POST handler and replace it with one that defaults to 'off'
    remove_action('comment_post', 'cren_persist_subscription_opt_in');
    add_action('comment_post', 'cren_persist_subscription_opt_in_alternate');
    // Also tests if an email is available at all
    function cren_persist_subscription_opt_in_alternate($commentId) {
        $value = 'on'
        if (isset($_POST['cren_subscribe_to_comment'])) {
            $value = $_POST['cren_subscribe_to_comment'] == 'on') ? 'on' : 'off';
        } else {
            $value = (($comment->comment_author_email != null)  ? 'on' : 'off';
        return add_comment_meta($commentId, 'cren_subscribe_to_comment', $value, true);

    And this would work for me, but what I’m saying is I think your plugin is ignorant of the fact that wordpress can be configured so emails are optional.

    If a user has emails configured as optional, and a commenter doesn’t give one, and they don’t bother unchecking the subscribe field, then your cren_comment_notification hook will still try to call wp_mail with an empty address. I think that fails with an email error, or it will email whomever any ‘wp_mail’ filters specify (such as CCing an admin), but not a recipient.

    If cren_comment_notification had the code:

    if ($email == null) {
        return false;

    …on line 64 of cren_plugin.php, then the comment notification would exit more gracefully. Also, my plugin won’t try to email blank addresses for all the comments made from before I installed your plugin.

    See what I mean?

    • This reply was modified 7 months, 3 weeks ago by flibbles.
    Plugin Author guhemama


    Thanks for the explanation, now I get it. I will see how I can add better error handling.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unsubscribed when no email given’ is closed to new replies.