Support » Plugin: Contact Form 7 » Contact form 7 send me a copy multilingual

  • Resolved omichon

    (@omichon)


    Hello,
    I would like to add a checkbox to my contact form on a multilingual web site.

    I tried the function described in this thread :

    but I can’t figure out how to adapt it for a multilingual site where the checkbox could be different values.

    I tried something like this :

    function my_wpcf7_use_mail_2_or_not( $additional_mail, $cf ) {
    	if ( "Send me a copy" != $cf->posted_data['send_copy'][0] ) {
    		$additional_mail = array();
    		}
    	elseif ( "Envoyez-moi une copie" != $cf->posted_data['send_copy'][0] ) {
    		$additional_mail = array();
    		}
    	return $additional_mail;
    }

    or like this :

    function my_wpcf7_use_mail_2_or_not( $additional_mail, $cf ) {
    	if ( "Envoyez-moi une copie" != $cf->posted_data['send_copy'][0] || "Send me a copy" != $cf->posted_data['send_copy'][0] )
    		$additional_mail = array();
    	return $additional_mail;
    }

    But without success.

    Any help would be appreciated.

    http://wordpress.org/plugins/contact-form-7/

Viewing 7 replies - 1 through 7 (of 7 total)
  • I finally find a way to do it with this code :

    function my_wpcf7_use_mail_2_or_not( $additional_mail, $cf ) {
    	if ( "" == $cf->posted_data['send_copy'][0] )
    		$additional_mail = array();
    	return $additional_mail;
    }

    That was quite simple, but not that much for the newbie I am.

    The code from my previous post doesn’t work anymore because of some changes in v3.9 (WPCF7_ContactForm object no longer has a posted_data property.). Any help to adapt this code for v3.9 would be welcome.
    Thanks in advance.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thanks for the link. I was able to point out the issue from reading it, but I am unable to adapt the new code to my function. I am just a real newbie to php 🙁

    Just had to try harder. All is fine again 🙂

    Hi.
    Tell me how to alter the code for the new version. I’m new to wp.

    I changed the previous code like this :

    function my_wpcf7_use_mail_2_or_not( $additional_mail, $cf ) {
    $cf = WPCF7_Submission::get_instance();
    if ( $cf ) {
    	$posted_data = $cf->get_posted_data();
    }
    
    	if ( "" == $posted_data['send_copy'][0] )
    		$additional_mail = array();
    
    	return $additional_mail;
    }

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Contact form 7 send me a copy multilingual’ is closed to new replies.