Modify posted data
-
Hello,
i am trying to modify the posted data of my form. I have tried adding an action in my functions.php named “wpcf7_before_send_mail”. Inside this action i have tried WPCF7_Submission::get_instance() and get_posted_data() modifying the posted data array but i haven’t got any luck.
Here is my code:
add_action(‘wpcf7_before_send_mail’, ‘mytheme_save_to_getresponse’, 10, 1);
function mytheme_save_to_getresponse($form)
{
try{// get current SUBMISSION instance
$submission = WPCF7_Submission::get_instance();// Ok go forward
if ($submission) {// get submission data
$data = $submission->get_posted_data_TIB();
$data[“yourage”]=33;}
update_user_meta(1, ‘-log-form’, json_encode((array)$form));
}
catch(Exception $ex){
update_user_meta(1, ‘-log-exception’, $ex->getMessage());
}return $form;
}How should i do to modify the posted data?
Thanks!
Regards
Rafael
The topic ‘Modify posted data’ is closed to new replies.