I have a test contact that I put in do not mail. I am trying to write the code to let them opt in again. I cannot figure this out.
the docs say to get all the details and append the new lists to the contact and then do an add. Edit contact doesnt have that option to add contact lists.
can I not just subscribe them back to a list and it work?
You can find details on opting in a subscriber who has opted out here. Basically this involves updating that contact to include the contact list you wish for them to be a part of. Also, the <OptInSource> for the contact MUST be "ACTION_BY_CONTACT" in order to indicate that the contact is the one taking the action to be opted back in.
I would be happy to help resolve this if you are having difficulties doing this, but would need some more details regarding what you are doing as well as the XML you are using to update the contact to opt them back in.
could you supply some sample php code for doing this? I am lost. Your sample update contact code does not show code for updating the lists. I was under the assumption that you had to add subscriptions after the contact was created.
I'd be happy to provide some sample code for this. Are you using the PHP Library or the PHP Sample Forms? This can be done with either sample, but if you are using the sample forms (not the PHP Library), the code to opt back in a contact would be the following:
If you are using the PHP library, let me know and I'll be happy to write up an example using that as well. If you have any questions please let me know.
The code you have given seems to have some issues as you define $response twice in a row.
I am trying to do the same thing that is "opt in" after a user has been removed and they have had their status changed to "Do not mail".
I cannot get your example to work. Would you please provide a working example? Thank you!
I certainly apologize for the code I posted earlier. I have no idea how that happened but this is clearly my mistake, as that code would not work at all.
I have edited my previous post with code that should work correctly for updating your contact. I apologize for any inconvenience that this issue has caused. Please let me know if you have any questions or concerns regarding this.
Thanks for the edit to the code.
I'm having an issue w/ the getSubscriberDetails code as it does not return the expected results. Please see my code below:
The print_r above returns:
Array ( [id] => [email_address] => [first_name] => [last_name] => [middle_name] => [company_name] => [job_title] => [home_number] => [work_number] => [address_line_1] => [address_line_2] => [address_line_3] => [city_name] => [state_code] => [state_name] => [country_code] => [zip_code] => [sub_zip_code] => [custom_field_1] => [custom_field_2] => [custom_field_3] => [custom_field_4] => [custom_field_5] => [custom_field_6] => [custom_field_7] => [custom_field_8] => [custom_field_9] => [custom_field_10] => [custom_field_11] => [custom_field_12] => [custom_field_13] => [custom_field_14] => [custom_field_15] => [notes] => [mail_type] => [status] => [lists] => Array ( ) )
I have tried this for emails that are Active and Do Not Mail.
Please let me know what might be wrong. The subscriberExists function works correctly in identifiying the email.
Maybe I have the wrong CC_Contact class? Would you send me a link to the correct one?
Without being able to see where your if statement ends, it sounds like you are performing the CC_Contact->getSubscriberDetails() function on an email address that does not exist, so you are seeing an empty set of properties for the returned Contact object. I believe that this is because you are testing to see if the subscriber does NOT exist ( if(!$ccContactOBJ->subscriberExists($_POST["subscribeEmail"]) )) , then pulling details for that email address.
If you were to use the code below, I believe that this will resolve your issue.