Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello @copley1,

    Please note that the way the form works now is the way it’s intended to work. The hide the form feature does not hides only after form submission. The form will be displayed again when you refresh. To hide it for users who have submitted the form you will need custom code that detects if our cookie exists in the user’s browser and then hide the form.

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    Please check https://github.com/ibericode/mc4wp-snippets/blob/master/forms/hide-form-for-people-that-subscribed.php. Using this code you should be able to hide the form.

    Thread Starter copley1

    (@copley1)

    Where do i put this new code?

    what file/folder and where?

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello @copley1,

    You have to put the code in the “functions.php” file located inside the folder which contains your current theme. You can place the below code at the end of the file below any other code:

    
    /**
     * Set a cookie whenever someone subscribes
     */
    add_action( 'mc4wp_form_subscribed', function() {
        setcookie( 'mc4wp_subscribed', 1, time() + 3600 * 24 * 90, '/' );
    });
    /**
     * Prints CSS that hides the MailChimp for WordPress form if the "subscribed" cookie is set.
     */
    add_action( 'wp_head', function() {
        if( isset( $_COOKIE['mc4wp_subscribed'] ) && empty( $_POST['_mc4wp_form_id'] ) )  {
            ?>
            <style type="text/css">
                .mc4wp-form {
                    display: none !important;
                }
            </style>
            <?php
        }
    }, 70 );
    Thread Starter copley1

    (@copley1)

    Thank you for explaining where it needs to go.

    How long does the cookie last for until the mailchimp sign up shows again?

    Also, if they clear cache then return to site surely the mailchimp sign up box will also return?

    Thread Starter copley1

    (@copley1)

    Also, do i need the option to hide when subscribed ticked in mailchimp when i use the above code?

    Thread Starter copley1

    (@copley1)

    In addition to the two message above.

    The code only hides the sign up box not the border and text.

    See two screenshots;
    https://monosnap.com/file/Sk7M3J09SUzOsoATOcslqqXtRqCRgq
    https://monosnap.com/file/JvtdfIfnlURsYzzQhS0DtcvvPMQ5Jd

    is there a way to fix this?

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello @copley1,

    – Yes you will still need to set the “Hide” option for on form submission
    – When the user clears cache, the form will appear again.
    – The form will be hidden for 90 days.
    – To hide the entire block, please update the CSS class in the code to target your main block.

    Also, please note custom code is beyond the scope of our support. For any further customization you might have to use a 3rd party developer/designer.

    Thread Starter copley1

    (@copley1)

    ok – and by default (without the extra code given above) what does the hide form after successful sign up do?

    Because without the above code setting the hide form boxed to ticked does nothing?

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey @copley1,

    I understand you do not find the feature useful. The “Hide” form, feature hides the form after the form is submitted. Other than that it does not do anything else. Our plugin does not connect to your MailChimp.com account on every page load as that would not be the best way so it can’t check if a user exists in a list and hide the form.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Have set mailchimp newsletter sign up to hide after successful sign up…’ is closed to new replies.