1

I’m working on implementing this plugin: https://github.com/aelvan/mailchimp-subscribe-craft I’m wondering: How can I accomplish to test if an address is on the list before it gets added? And on top of that return different results: you’ve already subscribed/you were added to the list.

That's my current status

{% if mailchimpSubscribe is defined %}
    {% if (not mailchimpSubscribe.success) and (mailchimpSubscribe.errorCode) %}
        {# display error message #}
    {% elseif craft.mailchimpSubscribe.checkIfSubscribed(mailchimpSubscribe.values.email, 'list-ID') %}
        {# display that the address is already added #}
    {% elseif (mailchimpSubscribe.success) %}
        {# display success message #}
    {% endif %}
{% else %}
    {# display default form #}
{% endif %}

Logically there can only be an error or already added output and no simple success because of if the form gets submitted the address is already submitted when the page reloads.

So, my question: How can I accomplish to test if an address is on the list before it gets added?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.