Skip to content

Instantly share code, notes, and snippets.

@gagimilicevic
Created April 7, 2017 13:32
Show Gist options
  • Save gagimilicevic/711ac7e2c2ed5381e110ff468260f002 to your computer and use it in GitHub Desktop.
Save gagimilicevic/711ac7e2c2ed5381e110ff468260f002 to your computer and use it in GitHub Desktop.
Integrate CF7 with MailPoet custom function on submit
function CF7_to_MailPoet_integration(){
$submission = WPCF7_Submission::get_instance();
$posted_data = $submission->get_posted_data();
$email = $posted_data['your-email'];
$my_list_id = 3;
$user_data = array(
'email' => $email,
);
$data_subscriber = array(
'user' => $user_data,
'user_list' => array('list_ids' => array($my_list_id))
);
$helper_user = WYSIJA::get('user','helper');
$helper_user->addSubscriber($data_subscriber);
}
add_action('wpcf7_before_send_mail','CF7_to_MailPoet_integration');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment