Skip to content

Instantly share code, notes, and snippets.

@groucho75
Last active June 11, 2016 01:17
Show Gist options
  • Save groucho75/1d44d76304ed6e2774a7a8c55a156fc0 to your computer and use it in GitHub Desktop.
Save groucho75/1d44d76304ed6e2774a7a8c55a156fc0 to your computer and use it in GitHub Desktop.
ALO-CF7 Integration - Updated
function my_easymail_add_subscriber ( $cf7 ) {
$submission = WPCF7_Submission::get_instance();
$data = $submission->get_posted_data();
$fields['email'] = $data["your-email"];
$fields['name'] = $data["your-name"];
if ( function_exists ('alo_em_add_subscriber') && is_email( $fields['email'] ) )
{
alo_em_add_subscriber( $fields, 1, alo_em_get_language(true) );
$subscriber = alo_em_get_subscriber( $fields['email'] );
if ( ! empty( $data["easymail-lists"][0] ) ) {
foreach( $data["easymail-lists"] as $list_id ) {
alo_em_add_subscriber_to_list ( $subscriber->ID, $list_id );
}
}
}
return $cf7;
}
add_action( 'wpcf7_before_send_mail', 'my_easymail_add_subscriber' );
@jeffmcneill
Copy link

jeffmcneill commented Jun 11, 2016

Hi Alo,

Great work. I integrated the instructions with the file and added . The file can be dropped into /wp-content/plugins/ and it just works (both for single installs and for multisite). This should help all the other folks who have the same desire to integrate with CF7.

See: https://gist.github.com/jeffmcneill/e7a53e11979ceddf81ec6c4764057c76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment