There are many great code snippets in their Gitlab. You might find more on their…
Integrate Mailster Subscription with Formidable Form
I wanted to have a checkbox to subscribe to my channel when submitting a formidable form. Fortunately, this is pretty easy with Formidable forms for WordPress. But I am still searching for a way to integrate with Forminator. Note: Formidable and Mailster need to be installed on the same WordPress instance for this script to work.
Just copy and paste into your functions.php and adapt IDs to your needs.
add_action('frm_after_create_entry', 'mailster_formidable_subscribe', 30, 2); add_action('frm_after_update_entry', 'mailster_formidable_subscribe', 30, 2); function mailster_formidable_subscribe($entry_id, $form_id){ if ( $form_id == 55 ) { //change 55 to the ID of your form // define to overwrite existing users $overwrite = true; // add with double opt in $double_opt_in = false; // prepare the userdata from a $_POST request. only the email is required $userdata = array( 'email' => $_POST['item_meta'][535], //change 535, 534, 533 to the ID of your email, first name and last name field 'firstname' => $_POST['item_meta'][533], 'lastname' => $_POST['item_meta'][534], 'status' => $double_opt_in ? 0 : 1, ); $subscriber_id = mailster( 'subscribers' )->add( $userdata, $overwrite ); if ( ! is_wp_error( $subscriber_id ) ) { // your list ids $list_ids = 1; mailster( 'subscribers' )->assign_lists( $subscriber_id, $list_ids ); } else { // actions if adding fails. $subscriber_id is a WP_Error object } } }add_action('frm_after_create_entry', 'mailster_formidable_subscribe', 30, 2); add_action('frm_after_update_entry', 'mailster_formidable_subscribe', 30, 2); function mailster_formidable_subscribe($entry_id, $form_id){ if ( $form_id == 55 ) { //change 55 to the ID of your form // define to overwrite existing users $overwrite = true; // add with double opt in $double_opt_in = false; // prepare the userdata from a $_POST request. only the email is required $userdata = array( 'email' => $_POST['item_meta'][535], //change 535, 534, 533 to the ID of your email, first name and last name field 'firstname' => $_POST['item_meta'][533], 'lastname' => $_POST['item_meta'][534], 'status' => $double_opt_in ? 0 : 1, ); $subscriber_id = mailster( 'subscribers' )->add( $userdata, $overwrite ); if ( ! is_wp_error( $subscriber_id ) ) { // your list ids $list_ids = 1; mailster( 'subscribers' )->assign_lists( $subscriber_id, $list_ids ); } else { // actions if adding fails. $subscriber_id is a WP_Error object } } }
source: https://pastebin.com/t4eRLyt5 Mailster, Formidable integration
Dieser Beitrag hat 0 Kommentare