• zimbo000

    (@zimbo000)


    All other status messages are shown OK, e.g. “A confirmation message is on its way!”, “That email address is not subscribed.”

    When a new subscriber clicks on the email confirmation link the user is redirected to the subscribe page with the shortcode but the page displays as standard, e.g. with an empty input box and subscribe buttons. The “success” message is not shown.

    The new user is however correctly added to Subscribe2 and they receive ‘new post’ emails.

    After much digging around I have found that the problem is caused by a plugin conflict with Jetpack, and specifically the Publicize and Sharing modules. If either is active, the Subscribe2 “success” message is not displayed. Deactivate them and the “success” message for Subscribe2 is displayed when clicking to confirm.

    [I deactivated all plugins on the site and switched on one at a time – it’s only Jetpack that is conflicting with Subscribe2. Some other activated Jetpack modules do not affect Subscribe2 but the site doesn’t use every Jetpack module – two that definitely cause a problem are Publicize and Sharing, but others I don’t use might.]

    The subscribe page is here: Subscribe to the Herald The Jetpack modules are active so the problem can be seen live – try adding yourself as a new subscriber to see ‘no message’; and then subscribe again to see a valid message.

    The site theme is inFocus but I have tried Twenty Fourteen and the same problem exists, so it’s not a theme issue.

    In posts such as https://www.ads-software.com/support/topic/plugin-subscribe2-successful-subscription-message-doesnt-display?replies=13 and https://www.ads-software.com/support/topic/plugin-subscribe2-confirmation-link-sending-to-subscription-form?replies=7 you identified potential solutions to similar confirmation problems.

    Please could you have a look and suggest a solution or workaround for this problem?

    As Jetpack is one of the best known plugins, I could also raise the issue with Jetpack if you think (and can identify what) they are doing something wrong.

    PS. This is kind of related to this post https://www.ads-software.com/support/topic/not-able-to-redirect-to-home-page-1?replies=7 but having narrowed down the numerous discussion elements in that thread and identified the root problem, I thought it best to post a new distinct issue.

    https://www.ads-software.com/plugins/subscribe2/

Viewing 11 replies - 16 through 26 (of 26 total)
  • @zimbo000

    You are getting strange behaviour on that message because you’ve commented out the $this->filtered lines, we need to find a better fix.

    Try removing those comments and let’s be less selective in killing Jetpack. You can actually put this as a function within the class in the class-s2-frontend.php file

    function s2_hide_jetpack_social( $modules ) {
    	return array();
    }
    Thread Starter zimbo000

    (@zimbo000)

    @mattyrob

    Didn’t work, just get the standard page displayed, no message.

    To confirm: I leave the other function in core.php with the add_filter line? Is there an add_filter for frontend?

    And a question: with the fixes being tried here, will the Publicize and Sharing modules of Jetpack still work? You mention “killing Jetpack” above.

    @zimbo000

    The function in the core file can be removed. The add_filter() still applies as the frontend class extends the core class.

    I’m Only disabling jetpack when the confirmation links are in use.

    Thread Starter zimbo000

    (@zimbo000)

    @mattyrob

    OK, to recap:
    s2_hide_jetpack_social function removed from core.
    add_filter in core as follows:

    if ( isset( $_GET['s2'] ) ) {
    				// someone is confirming a request
    				if ( defined('DOING_S2_CONFIRM') && DOING_S2_CONFIRM ) { return; }
    				define( 'DOING_S2_CONFIRM', true );
    				add_filter( 'jetpack_get_available_modules', array( &$this, 's2_hide_jetpack_social' ) );
    				add_filter('request', array(&$this, 'query_filter'));
    				add_filter('the_title', array(&$this, 'title_filter'));
    				add_filter('the_content', array(&$this, 'confirm'));
    			}

    Revised “less selective” function added to front-end as follows:

    <?php
    class s2_frontend extends s2class {
    // Jetpack fix
    	function s2_hide_jetpack_social( $modules ) {
    	return array();
    	}
    
    	/**
    	Load all our strings
    	*/
    	function load_strings() {

    All instances of this->filtered = 1; now live i.e. uncommented, in frontend

    Results for subscribe and unsubscribe – user added and deleted in admin after clicking confirmation email link; standard subscribe screen displayed after click, i.e. no “success” message shown, so it doesn’t work I’m afraid.

    I also tried this in frontend, but it didn’t work either:

    function s2_hide_jetpack_social( $modules ) {
    	unset( $modules['publicize'] );
    	unset( $modules['sharedaddy'] );
    	unset( $modules['site-icon'] );
    	return $modules;
    	}

    @zimbo000

    Hmm, try this. Comment out the define in the first block of code you pasted above like this:

    if ( isset( $_GET['s2'] ) ) {
    				// someone is confirming a request
    				if ( defined('DOING_S2_CONFIRM') && DOING_S2_CONFIRM ) { return; }
    				//define( 'DOING_S2_CONFIRM', true );
    				add_filter( 'jetpack_get_available_modules', array( &$this, 's2_hide_jetpack_social' ) );
    				add_filter('request', array(&$this, 'query_filter'));
    				add_filter('the_title', array(&$this, 'title_filter'));
    				add_filter('the_content', array(&$this, 'confirm'));
    			}

    I’ve got another idea, this might be a better approach also for other plugins.

    Remove the function and filter that we’ve been trying for Jetpack module deactivation.

    Further up in the same confirm() function in the frontend.php file fine these lines:

    if ( 1 === $this->filtered ) {
    	return $content;
    }

    Replace that with this:

    if ( 1 === $this->filtered && '' !== $this->message ) {
    	return $this->message;
    } elseif ( 1 === $this->filtered ) {
    	return $content;
    }

    How’s that?

    Thread Starter zimbo000

    (@zimbo000)

    The comment out of the define on #21 did not work but… the last code segment #22 did! Subscribe and unsubscribe both OK.

    However, the original code line only had two equal signs, e.g.
    if ( 1 == $this->filtered )
    but above you state three in places, and I’ve used three in the replacement code just as you wrote. Is three correct / does this matter?

    @zimbo000

    Cracked it at last!! ??

    The == or === won’t make any difference in this case. Generally, === (and !==) are now considered more desirable to use that == (and !=) as they are more robust and compare more accurately. This explains it better than I can:

    https://www.copterlabs.com/blog/strict-vs-loose-comparisons-in-php/

    Thread Starter zimbo000

    (@zimbo000)

    @mattyrob

    Everything seems OK in continued testing, client is considering the HTML version. Are you still involved with Subscribe2 HTML? (I believe you originally developed it.)

    @zimbo000

    I am still the developer of Subscribe2 HTML. I am only involved in supporting the free version these days but still actively develop for the HTML version.

    Thanks @zimbo000 and @mattyrob.

    I have had the same issue as @zimbo000. Managed to solve the problem by modifying the plugin ..frontend.php line 288 with this code:

    if ( 1 === $this->filtered && '' !== $this->message ) {
    	return $this->message;
    } elseif ( 1 === $this->filtered ) {
    	return $content;
    }

    and now can show a custom message by applying the filter.

    Hope this will be modified in the next plugin update.

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘'You have successfully subscribed!' message not displayed – plugin conflict’ is closed to new replies.