Hoping someone could help me figure out how to connect my email newsletter subscription form with an email marketing platform called Drip.
From reading in another post it seems like setting “Custom” just activates the hook but the action still needs to be set up in php with something like this:
<?php
function my_form_custom_action( $form ) {
// $fields = $form->get_fields();
// $formId = $fields['formId'];
// $postId = $fields['postId'];
// $settings = $form->get_settings();
// $files = $form->get_uploaded_files();
// Perform some logic here...
// Set result in case it fails
$form->set_result([
'action' => 'my_custom_action',
'type' => 'success', //or danger or info
'message' => esc_html__('Oh my custom action failed', 'bricks'),
]);
}
add_action( 'bricks/form/custom_action', 'my_form_custom_action', 10, 1 );
However according to Drip I need to pass some parameters through this code:
- Set the form
action
attribute tohttps://www.getdrip.com/forms/857326420/submissions
. - Set the form
method
attribute topost
. - Set the name of the email input to
fields[email]
. - Add
data-drip-attribute="headline"
to your headline tag. - Add
data-drip-attribute="description"
to your description tag.
I also need to “Add the data-drip-embedded-form="857326420"
attribute to the <form>
tag”
Anyone have some suggestions on how I could do this? I’m not very experienced in php.