laravel-mailchimp icon indicating copy to clipboard operation
laravel-mailchimp copied to clipboard

How to disable double opt-in?

Open simplenotezy opened this issue 11 years ago • 4 comments

I have tried this:

  MailchimpWrapper::lists()->subscribe('some_id', array('email'=>'[email protected]'), array('double_optin'      => false));

simplenotezy avatar Nov 19 '14 00:11 simplenotezy

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));

mbsmi avatar Nov 22 '14 22:11 mbsmi

This works for me:

MailchimpWrapper::lists()->subscribe($list_id, array('email' => $input['email']), null, null, false, true);

null is first name and last name

bartmoons avatar Dec 24 '14 00:12 bartmoons

Thanks @bartmoons will try this out and see if it will also work for me.

hoshomoh avatar Dec 30 '14 23:12 hoshomoh

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.

zeckdude avatar Nov 25 '15 06:11 zeckdude