Subscription with Contact Form 7
-
Hi,
I would like to register the email in a list after sending a message with contact form 7.
So I put this code in function.php, but it don’t work. I’m not a developer , I think my code is not correct… Help please …
My code :function contactform7_subscribe2($cfdata) { $submission = WPCF7_Submission::get_instance(); $formdata = $submission->get_posted_data(); $user_name = $formdata['your-name']; $user_email = $formdata['your-email']; $list_id = "3"; //Problem here $this->$MailjetApi = new WP_Mailjet_Api(get_option('mailjet_username'), get_option('mailjet_password')); $result = $this->$MailjetApi->addContact(array( 'Email' => ($user_email, 'ListID' => $list_id )); } if(isset($_POST['opt-in'])) { add_action('wpcf7_mail_sent', 'contactform7_subscribe2', 1); }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Subscription with Contact Form 7’ is closed to new replies.