Calling All Developers 
Connect with fellow code ninjas in the Constant Contact Community.

Occasional Participant
Posts: 5
Registered: ‎03-25-2009

Subscribe after unsubscribe?

When a user unsubscribes from my site and then comes back later and subscribes again, the user is not added to the list.

I am using an implementation of this API example

If the user had unsubscribed and then fills out the form again, they should be re-subscribed.
Posts: 1,749
Topics: 8
Kudos: 89
Solutions: 64
Registered: ‎06-19-2008

RE: Subscribe after unsubscribe?

This sample script only has the functionality for adding new customers. If a customer unsubscribes and than wants to be added back in, this is a form of an Update. Please see the documentation in the "Opting-in a Contact" section at the bottom of this page for more information for how to update and re-subscribe a contact.
Dave Berard
Senior Product Manager, Constant Contact
Occasional Participant
Posts: 5
Registered: ‎03-25-2009

Thanks, that helps;

But is there an example available that will first check if they are unsubscribed, and either add them or resubscribe them based on the result?

In other words, a combination of these two samples?

I'd rather not reinvent the wheel.
Solution Provider
Posts: 31
Registered: ‎05-28-2008

Re:Thanks, that helps;

I have been working on taking the PHP example and adding more features to it, but it not done yet. I will show you what I have now and maybe you can get it to work for you.

You can download my example here


Mike C Support Engineer, Constant Contact

Occasional Participant
Posts: 5
Registered: ‎03-25-2009

Thank You

Thank you, Mike. I was able to tailor that example to fit my needs.

One small error you may want to fix is that you are outputting the error message for "missing field" twice, because it is outputted immediately within the logic as well as later on in "echo $output;". Of course, that is a very small error in a very useful example file.

Thanks again,
Occasional Participant
Posts: 5
Registered: ‎03-25-2009

Form just broke!


My client just informed me that their CC form is no longer working. I am using this example and it was working fine. Now I am getting a 401 authentication error. I haven't changed anything. Did something change on CC?

Valued Developer
Posts: 186
Registered: ‎03-07-2008

re: Form just broke

Hello standford,

The most common reason for a 'sudden' 401 error is that the username or password for the account has changed. Are you certain that the credentials used in your script are still valid?

Tom M
Group Product Manager – Content Editing
Constant Contact
Occasional Participant
Posts: 5
Registered: ‎03-25-2009

The username and password are

The username and password are correct. I copied and pasted from the code to the CC login page and it worked.