Created
December 9, 2024 07:11
-
-
Save finalwebsites/a5f36bd0fc6af000b7c731d5e892c85d to your computer and use it in GitHub Desktop.
Revisions
-
finalwebsites created this gist
Dec 9, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ <?php // Place this code into the functions.php file or your WordPress child theme add_action('wpcf7_mail_sent', 'fw_wpcf7_subscribe_to_eo4wp' ); function fw_wpcf7_subscribe_to_eo4wp( $contact_form ){ // get form id $form_id = $contact_form->id(); // get submission data $submission = WPCF7_Submission::get_instance(); $posted_data = $submission->get_posted_data(); if (!empty($posted_data['newsletter'])) { $tag = 'newsletter'; $data = array('tags' => $tag, 'FirstName' => $posted_data['your-name']); $list = get_option('fweo_emailoctopus_list_id'); $eo = new FWEO_EmailOctopus_integration(); $eo->add_subscriber($posted_data['your-email'], $list, $data); } }