Send me a copy checkbox
-
Hi!
I’ve read that it’s possible to make a checkbox for “Send me a copy” function. But every code I’ve found are outdated.
I use this code now in my functions.php:
function check_mail_send_contactform($cf7) { //get CF7’s mail and posted_data objects $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $posted_data = $submission->get_posted_data(); } $mail = $cf7->prop( ‘mail’ ); if($posted_data[‘send_c’][0]) { //if Checkbox checked $mail2 = $cf7->prop( ‘mail_2′ ); //get CF7’s mail_2 object //now activate mail_2, the value 0 means not active $mail2[‘active’] = 1; $cf7->set_properties( array( ‘mail_2′ => $mail2 ) ); } return $cf7; } add_action(‘wpcf7_before_send_mail’,’check_mail_send_contactform’);
and this code in my form:
[checkbox send_c “Másolatot kérek”]
/*Másolatot kérek = send me a copy in Hungarian */and of course I’ve set Mail(2) to enable, set [your-email] to receiver and than disabled it, but still nothing happens if I check the box on frontend and submit the form.
I get the mail for the primary email, but not for the secondary I’ve entered. And of course they’re different emails.
Can someone help me with this?
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Send me a copy checkbox’ is closed to new replies.