Support » Plugin: Contact Form 7 » if (($wpcf7_data->id == xx)) { doesn't work in CF7 version 3.9??

  • Resolved DDT

    (@ddt)



    Hello,

    It seems when i use CF7 v 3.8.1 this function works:

    function wpcf7_add_invoicedata(&$wpcf7_data) {
        global $wpdb;
        if (($wpcf7_data->id == xx)) {
    .....
    }
    }
    
    add_action("wpcf7_before_send_mail", "wpcf7_add_invoicedata");

    But with CF7 v3.9 it doesn’t work???? (also upgraded to 3.9.1 and it doesn’t work)
    How can i fix this?

    Regards

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • hmm i have deleted the & so
    wpcf7_add_invoicedata(&$wpcf7_data) {

    becomes
    wpcf7_add_invoicedata($wpcf7_data) {

    but all the form data is empty????

    ok i found the solution: http://contactform7.com/2014/07/02/contact-form-7-39-beta/

    For my project these changes where the most important

    /* Don't do this, since id property is no longer accessible. */
    $id = $contact_form->id; // Wrong.
    
    /* Use id() method instead. */
    $id = $contact_form->id();

    and

    /* WPCF7_ContactForm object no longer has a posted_data property. */
    $posted_data = $contact_form->posted_data; // Wrong.
    
    /* Use WPCF7_Submission object's get_posted_data() method to get it. */
    $submission = WPCF7_Submission::get_instance();
    
    if ( $submission ) {
        $posted_data = $submission->get_posted_data();
    }

    Hi
    what files did you changed?
    thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘if (($wpcf7_data->id == xx)) { doesn't work in CF7 version 3.9??’ is closed to new replies.