Trying to capture form data with custom function, not passing data
-
So I have a function written that takes submitted CF7 form data and parses it into user metadata. I have tested it and it works on single contact forms with no issue. The problem I’m having is that at the end of the multistep form it’s not submitting.
Here’s the basic function:
//Onboard Data Export add_action( 'wpcf7_before_send_mail', 'vbg_user_onboard' ); function vbg_user_onboard( $contact_form ){ if (!isset($contact_form->posted_data) && class_exists('WPCF7_Submission')) { $log .= 'posted data set and class exists!\n'; $submission = WPCF7_Submission::get_instance(); $current_user = wp_get_current_user(); $user_id = $current_user->ID; if ($submission) { $log .= 'submission exists!\n'; $formdata = $submission->get_posted_data(); } if( !empty($formdata['past-claim'])){ //parse user data $user_email = $formdata['user-email']; $user_filed_before = $formdata['past-claim']; //User Meta $user_meta = array( 'filed_before' => $user_filed_before, ); //Set metadata update_user_meta( $user_id, "filed_before", $user_meta['filed_before'] ); } }//end }
Is there a specific way that data is handled in these forms? How do I get the posted data? The emails seem to send just fine with no errors in passing the data so it must be there.
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Trying to capture form data with custom function, not passing data’ is closed to new replies.