Get Contact Form 7 Posted Data in PHP - Updated for v3.9
Use this function...added to your Wordpress theme's functions.php file
Thanks to Paulo's post here:
http://getlostandwander.blogspot.com/2014/07/contact-form-7-new-way-to-save-data.html
This PHP function is run before the form sends an email. You can use this to store the form data in a database or post to another system.
The old $cf7->posted_data['your-email'] doesn't collect the form posted data in the new version of Wordpress Contact Form 7 v3.9+
function something_before_sending_email($cf7) {
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$name = $_POST['your-name'];
$email = $_POST['your-email'];
}
}
add_action('wpcf7_before_send_mail',something_before_sending_email');
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$name = $_POST['your-name'];
$email = $_POST['your-email'];
}
}
add_action('wpcf7_before_send_mail',something_before_sending_email');
Thanks to Paulo's post here:
http://getlostandwander.blogspot.com/2014/07/contact-form-7-new-way-to-save-data.html
Comments
Post a Comment