Pro Forms - Conditional 'Mailchimp' Action

Hey guys :wave:,

I’m trying to create a simple contact form with a checkbox where the sender give permission for his details to be added onto Mailchimp marketing list.

Something similar to this one: checkout-email-consent hosted at ImgBB — ImgBB
You’ve probably see it on hundreds of other websites, but this is proving to be quite difficult with Bricks. I’ve already touched up on it in this thread here: NO BUG: Issue connecting to Sendgrid list - #5 by Bloggs - Bugs - Bricks Community Forum

In a nut shell, I’ve got a contact form where website visitors send me an enquiry.

Now, I want to be cheeky and I want to add their email address onto my Mailchimp marketing list, so I can hit them with marketing messages.

However, due to GDPR, I need to get the sender’s permission where they agree, for his email to be added onto my Mailchimp list.

So I would like to add a simple checkbox to the form asking user for the permission.

If the checkbox is checked, this means that the user agrees with me adding the details for Mailchimp. In this case, two actions are triggered - Email action that sends the enquiry, and the Mailchimp action that records the details on my connected Mailchimp list.

But If that checkbox stays unchecked, that means that the user doesn’t agree. In this case only the Email action is triggered to send the enquiry, but not the Mailchimp action since user didn’t give permission.

So with the Pro Forms, is it possible to create a condition for the action itself ? If checkbox is checked, then both actions Email & Mailchimp are triggered. If the checkbox is not checked, then only Email action is triggered?

Or is there any other way I could achive this in the Form?

Thanks, Jo

1 Like

Hello!

I was about to start a topic in the forum asking for the same question!

Same scenario: a contact form that need to be connected to Mailchimp. Due to RGPD, if the user doesn’t give consent, we cannot send their details into Mailchimp. So I have a checkbox field that the users need to check. But I don’t find any docs on how to be able to only send data to Mailchimp if that checkbox field is checked.

Any ideas on how to implement this with BF Pro Forms?

Thank you!! :blush:

And happy holidays to everyone in this amazing community!! :christmas_tree:

Hello!

Any news about this?

This requirement is mandatory to be RGPD compliant in any form that has an opt-in checkbox to any email marketing service provider like MailChimp!

I am stuck on this!

Thank you!

Just thinking out loud here so maybe someone else can chime in whether my theory would work or not haha.

My theory assumes that setting 'action' => 'mailchimp' in a custom action, would trigger the mailchimp action as it is defined in bricks / bricksforge.

If that is indeed the case, we could use something like this:

function custom_mailchimp_action( $form ) {  

  if( $form_id !== 'your-form-id' ) return;

  $settings = $form->get_settings();

    if (isset($field['label']) && $field['label'] == 'mailchimp-checkbox') {
      if ( $field['value'] == 'true') {
        $form->set_result([
        'action' => 'mailchimp',
        'type'    => 'success',
        'message' => esc_html__('Yay', 'bricks'),
      ]);
      }
    }
  
}
add_action( 'bricks/form/custom_action', 'my_form_custom_action', 10, 1 );

Basically we just check if the subscribe checkbox is checked, and only if it is, trigger the mailchimp action.

1 Like

Hey @manc :wave:

Thanks for that, that looks really promissing.

@Daniele what do you reckon, could this work?

I understand that this is an important thing. That’s why I’m prioritising Action Conditions for the next updates. This means that an action is only executed if the conditions are met. Until then, try manually coded ways like @manc suggested. :slight_smile:

3 Likes

That’s awesome, thanks so much @Daniele :clap:t3: I believe this will be a really helpful feature for many.

Thank you very much for your help, @manc :blush:

However, I will wait for the official launch of the form actions conditions that @Daniele mentioned, as it will be much easier to implement for me.

Daniele, any ETA?

1 Like

Hello, I am also looking to add email and name fields to Mailchimp only if a tick box is checked to confirm agreement. Is this something that is now possible with BrickForge Pro Forms?
Many thanks for the update.