How to modify the user input with wpcf7_before_send_mail?
-
I’ve been searching for a solution quite a while, so I’m asking the community … I want to format (e.g. strtolower, ucwords, …) the user input of certain fields before they are sent through mail and stored in my database. Using the action hook I’m able to retrieve the posted data (in this case for the ‘Responsable’ field), but I can’t find how to update them:
add_action( 'wpcf7_before_send_mail', 'wpcf7_format_input' ); function wpcf7_format_input($cf7) { $submission = WPCF7_Submission::get_instance(); $posted_data = $submission->get_posted_data(); $posted_data['Responsable'] = ucwords(strtolower($posted_data['Responsable'])); $submission->set_posted_data(); // This is obviously wrong! }
Any clues? If you need it, this is the site.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to modify the user input with wpcf7_before_send_mail?’ is closed to new replies.