• Hello,

    CF7DB saves very well form from CF7 and use data from $_POST to create the new columns in the admin of CF7DB.

    But I need to add a custom column. I know that I need to edit $_POST by adding something like $_POST[“mycolumn”] = “test” but it does not work if I do that in wpcf7_before_send_mail.

    add_action(‘wpcf7_before_send_mail’, ‘_wpcf7_before_send_mail’, 4);

    function _wpcf7_before_send_mail4($cf7)
    $_POST[“testabc5555”] = “test”;

    // Get current form
    $wpcf7 = WPCF7_ContactForm::get_current();

    // Get current SUBMISSION instance
    $submission = WPCF7_Submission::get_instance();

    if ($submission) {
    // get submission data
    $fields = $submission->get_posted_data();

    // fields will NOT contain the $_POST[“testabc5555”]
    var_dump($field);
    }
    }

    It WORKS in wp_loaded but I do not have access to $cf7 because I think CF7 is not instancied. So this is not the solution because I need to know the ID or the name of the form… (I have several forms on my website and only one need the custom column)

    add_action(‘wp_loaded’, ‘_wp_loaded’, 10, 1);

    function _wp_loaded($cf7)
    $_POST[“testabc5555”] = “test”;
    }

    So, where should I add $_POST[“testabc5555”] = “test”; ? Please note that “test” is an example. My real value is dynamic so I can not use it with an hidden field.

    Thanks for your help

    • This topic was modified 7 years, 7 months ago by Kreeger.
  • The topic ‘Add custom POST data to CFDB’ is closed to new replies.