• Hi,

    I’m using last version of plugin (5.0). I want to modify dynamically the email address where is sent. I have this function for test purposes:

    add_action( ‘wpcf7_before_send_mail’, ‘action_wpcf7_before_send_mail’ );
    function action_wpcf7_before_send_mail( $contact_form ) {
    if (1093 == $contact_form->id()) {

    $wpcf7 = $contact_form::get_current();
    $submission = WPCF7_Submission::get_instance();
    if ($submission) {
    $posted_data = $submission->get_posted_data();
    $mail = $wpcf7->prop(‘mail’);
    $mail[‘body’] .= print_r($posted_data,true);
    $wpcf7->set_properties(array(
    “mail” => $mail
    ));
    return $wpcf7;
    }
    }
    };

    I want to capture posted data, and I get the array but this way:

    Array
    (
    1093 => 1093
    5.0 => 5.0
    es_ES => es_ES
    wpcf7-f1093-o1 => wpcf7-f1093-o1
    0 => 0
    eeepeee => eeepeee
    [email protected] => [email protected]
    fsdf asfsdfsf => fsdf asfsdfsf
    )

    The array keys have same values as de array values, so I can’t capture data. Anyone experience the same behavior?

    Is this a bug?

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘get_posted_data returns wrong array’ is closed to new replies.