I would like to use the Bricks form for the Mailpoet registration. Has anyone already added such a function?
Tank you!
I would like to use the Bricks form for the Mailpoet registration. Has anyone already added such a function?
Tank you!
Hi Claudio,
Did you manage to get it working? I’m also trying to figure out how to add a subscriber to my MailPoet list via Bricksbruilder Forms.
Hi @MassAppeal
Unfortunately not. I used the ugly form from MailPoet with shortcode . But you have to make a few adjustments in the css to make it look good. Needs more time
If you find another solution, please let me know.
Waiting someone with better solution for integration too .
Currently the mainstay form is FluentForms because there is integration addon for Mailpoet.
Unfortunately, neither do I. MailPoet does not offer a webhook/api solution out of the box. I’m afraid I’ll have to look for another solution (for now).
I haven’t tried it, but I was just wondering about the same thing for future builds and came across this https://www.youtube.com/watch?v=bNpPQQSpmL4 which shows how to use a plugin called Bit Integration that is apparently free.
I’m just building my first site with Bricks and coming from Oxygen, and I used Piotnet Forms which allowed me to add a checkbox to a form to allow people to subscribe to mailpoet lists at the same time they were filling out the contact form. I think Piotnet integrates with Bricks, too, but it would be even better if I could skip another plugin altogether and just use the Bricks form.
I’ve used the following code based on the Mailpoet documentation and added it to my functions.php file:
function form_mailpoet_custom_action( $form ) {
// load MailPoet API
if ( ! class_exists(\MailPoet\API\API::class)) {
return;
}
// Get form fields
$fields = $form->get_fields();
// Map form data to subscriber data (adjust field-IDs based on your form)
$subscriber_data = [
'email' => $fields['form-field-f111af'],
'first_name' => $fields['form-field-0d9ab7'],
'last_name' => $fields['form-field-ztdmwp']
];
// List-IDs the subscriber should be added to (adjust the ID based on your lists)
$list_ids = [3];
// Define Options
$options = [
'send_confirmation_email' => true,
'schedule_welcome_email' => false,
'skip_subscriber_notification' => false
];
try {
// Add subscriber to Mailpoet
$subscriber = \MailPoet\API\API::MP('v1')->addSubscriber($subscriber_data, $list_ids, $options);
// Success Message
$form->set_result([
'action' => 'my_custom_action',
'type' => 'success',
'message' => esc_html__('Please check your inbox or spam folder to confirm your subscription.', 'bricks'),
]);
} catch (\Exception $e) {
// Error message
$form->set_result([
'action' => 'my_custom_action',
'type' => 'error',
'message' => esc_html__('Subscription failed: ' . $e->getMessage(), 'bricks'),
]);
}
}
add_action( 'bricks/form/custom_action', 'form_mailpoet_custom_action', 10, 1 );
Hope this helps
Hi Simone,
It seems like this code isn’t working as expected. I’ve adjusted the field-IDs based on my form and changed the list-ID, but after submitting the form, it doesn’t add the subscriber to my MailPoet list.
Did you manage to get it working?
Hi,
Yes it works for me.
Have you selected “Custom” as the form action?
After selecting Custom as the form action, it’s working now
Thank you so much for your solution! I really appreciate your help.
I’m glad to hear it’s working now
You are very welcome.
Hi @simone - what if one has multiple lists, depending on the form?
Perhaps you could suggest a solution for this?
That would be so helpful to the community~
Thanks.