laravel-mailchimp
laravel-mailchimp copied to clipboard
How to disable double opt-in?
I have tried this:
MailchimpWrapper::lists()->subscribe('some_id', array('email'=>'[email protected]'), array('double_optin' => false));
I am needing to find out the same for disabling double opt in and to update an existing email address.
The code that I have attempted to use is:
MailchimpWrapper::lists()->subscribe('list_id', array('email' => Input::get('email'), array('FNAME' => Input::get('first_name'), 'LNAME' => Input::get('last_name')), 'double_optin' => false, 'update_existing' => true));
This works for me:
MailchimpWrapper::lists()->subscribe($list_id, array('email' => $input['email']), null, null, false, true);
null is first name and last name
Thanks @bartmoons will try this out and see if it will also work for me.
I was looking for a solution where I can write the option names as keys for a multidimensional array like so:
MailchimpWrapper::lists()
->subscribe($list_id,
array(
'email' => $email_address,
),
array(
'merge_vars' => array('FNAME' => $first_name, 'LNAME' => $last_name),
'double_optin' => false,
'update_existing' => true,
'replace_interests' => false,
'send_welcome' => false
)
);
But unfortunately I couldn't figure out the syntax for that (if it is even possible), so thanks for @bartmoons' suggestion, I was able to get it work like so:
MailchimpWrapper::lists()
->subscribe($list_id,
array(
'email' => $email_address,
),
array('FNAME' => $first_name, 'LNAME' => $last_name),
"html", // email type
false, // double optin
true, // update existing
false, // replace interests
false //send welcome
);
Using this approach you will need to add each parameter, at least until the one you want to specify, even though they're actually optional.