I have a module I'm composing that I need to cooperate with Contact Structure 7. In my module I added the accompanying activity add_action
add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");
function wpcf7_do_something_else(&$wpcf7_data) {
// Here is the variable where the data are stored!
var_dump($wpcf7_data);
// If you want to skip mailing the data, you can do it...
$wpcf7_data->skip_mail = true;
}
I presented the contact structure however the add_action I had sat idle. I'm uncertain how to make my module catch or accomplish something when Contact Structure 7 follows through with something. Any, assist on how with doing this?
Solutions
I needed to do this to keep Email from being sent. Trust it makes a difference.
/*
Prevent the email sending step for specific form
*/
add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");
function wpcf7_do_something_else($cf7) {
// get the contact form object
$wpcf = WPCF7_ContactForm::get_current();
// if you wanna check the ID of the Form $wpcf->id
if (/*Perform check here*/) {
// If you want to skip mailing the data, you can do it...
$wpcf->skip_mail = true;
}
return $wpcf;
}
This code expects that you are running the most recent form of CF7 your code above used to work several months prior when they proceeded to do some refactoring of the code. [Apr 28 '15]