WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
Allow subscriptions from the comment form not working (10 posts)

  1. elarson
    Member
    Posted 2 years ago #

    Using subscribe2 7.0.1 the "Display checkbox to allow subscriptions from the comment form" does not seem to be working.

    It does display, but the e-mail does not show up as a public subscriber as I would have thought they would.

    Has anyone else had this problem?

    http://wordpress.org/extend/plugins/subscribe2/

  2. mattyrob
    Member
    Plugin Author

    Posted 2 years ago #

    @Ellyn,

    I've just tested this on my site and it works for me.

    The only thing that might need explained is if the comment is in moderation. If the comment is there then the subscription is held until the comment is approved. This was done to avoid administrators have to erase spam email addresses from the public subscriber database in the event that anti-spam measures were not used or temporarily non-functional.

  3. elarson
    Member
    Posted 2 years ago #

    How should it behave it comments are not held for moderation?

    Just to be clear, here are the WP Discussion Settings:

    Other comment settings
    checked Other comment settings Comment author must fill out name and e-mail
    unchecked Users must be registered and logged in to comment

    E-mail me whenever
    E-mail me whenever Anyone posts a comment
    A comment is held for moderation

    Before a comment appears
    unchecked Before a comment appears An administrator must always approve the comment
    unchecked Comment author must have a previously approved comment

  4. mattyrob
    Member
    Plugin Author

    Posted 2 years ago #

    @Ellyn,

    If comments are instantly approved (as would appear the case from your settings), then provided the email address given is not already subscribed and the box is checked it should be automatically added as a public subscriber.

    I'll check this again later after duplicating your settings.

  5. elarson
    Member
    Posted 2 years ago #

    I also just tested this again after upgrading to 7.1 and still don't see the subscriber listed in s2/subscribers.

  6. mattyrob
    Member
    Plugin Author

    Posted 2 years ago #

    @Ellyn,

    Thanks for persisting and posting the information I needed. I've tracked it down and fixed it now.

    If you want to apply the fix yourself open up the subscribe2.php file in a text editor and find the s2_comment_meta() function. Replace what's there with this:

    function s2_comment_meta($comment_ID, $approved) {
    		if ( $_POST['s2_comment_request'] == '1' ) {
    			global $wpdb;
    			$sql = "SELECT comment_author_email, comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_ID' LIMIT 1";
    			$comment = $wpdb->get_row($sql, OBJECT);
    			if ( empty($comment) ) { return $comment_ID; }
    			switch ($approved) {
    				case '0':
    					// Unapproved so hold in meta data pending moderation
    					add_comment_meta($comment_ID, 's2_comment_request', $_POST['s2_comment_request']);
    					break;
    				case '1':
    					// Approved so add
    					$is_public = $this->is_public($comment->comment_author_email);
    					if ( $is_public == 0 ) {
    						$this->toggle($comment->comment_author_email);
    					}
    					$is_registered = $this->is_registered($comment->comment_author_email);
    					if ( !$is_public && !$is_registered ) {
    						$this->activate($comment->comment_author_email);
    					}
    					break;
    				default :
    					break;
    			}
    		}
    	}
  7. mattyrob
    Member
    Plugin Author

    Posted 2 years ago #

    @Ellyn,

    Oh yes and you'll also need to look for this line"
    add_action('comment_post', array(&$this, 's2_comment_meta'), 1);

    And change it to:
    add_action('comment_post', array(&$this, 's2_comment_meta'), 1, 2);

  8. elarson
    Member
    Posted 2 years ago #

    Any chance you can give me line numbers or send your updated code?

  9. mattyrob
    Member
    Plugin Author

    Posted 2 years ago #

    The function to replace starts at lone 3305 in subscribe2.php if you are using version 7.1. The add_action() line is on 4001.

  10. elarson
    Member
    Posted 2 years ago #

    Hi MattyRob,

    Thanks for the line numbers. I tested it fairly extensively and it functioned as I would think it should. That did the trick, and now subscriptions from comments are working! Thank you very much.

    BTW, I am also using the plugins Subscribe to Comments Reloaded and Theme My Login, should anyone else be interested in their compatibility, and they are compatible.

    Regards,
    Ellyn

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags