Before Send action hook
-
I am using WP 4.2.4 and CF7 4.2.2 and I have a form that is loaded from a series of links that specify which recipient to use for the form. The links look like –
/contact/contact-sales/?t=2
Depending on the value of the “t” variable, the form will be directed to the proper recipient.
My actionhook looks like this –
function wpcf7_do_something (&$WPCF7_ContactForm) {
if (isset($_GET[‘t’]) && $_GET[‘t’] < 5 && $_GET[‘t’] > 0) {
if ($_GET[‘t’] == ‘1’) { $WPCF7_ContactForm->mail[‘recipient’] = “aaaa@example.com”; }
else if ($_GET[‘t’]==’2′) { $WPCF7_ContactForm->mail[‘recipient’] = “bbbb@example.com”; }
else if ($_GET[‘t’]==’3′) { $WPCF7_ContactForm->mail[‘recipient’] = “ccc@example.com”; }
else { $WPCF7_ContactForm->mail[‘recipient’] = “dddd@example.com”; }
}
}add_action(“wpcf7_before_send_mail”, “wpcf7_do_something”);
I have saved this in the plugins folder, and activated it via the WP admin, where I can visually see that it’s activated.
The action is not working.
The site was updated very recently from WP3.5.2 to the current version, and I’m pretty sure this was working in the previous version. Can anyone see any obvious mistakes, or any reason it would stop working in these two current versions of WP and CF7?
Thanks!
The topic ‘Before Send action hook’ is closed to new replies.