[Plugin] Contact Form 7 – Change result message before submit on function error
-
Hi,
i read a lot of tricks about with wpcf7_mail_sent or wpcf7_before_send_mail.I’m using the wpcf7_before_send_mail function but i need to change the result[‘message’] if my php function inside return an error.
I did:
add_action( 'wpcf7_before_send_mail', 'MyChange'); function MyChange($contact_form) { $idForm = $contact_form->id; $posted_data = $contact_form->posted_data; if ( 1367 == $idForm) { try { myfunction ($posted_data); } catch (Exception $e){ $contact_form->skip_mail = true; (********)$contact_form->result['message'] = $e->getMessage(); } } }Obviously e (********) line doesn’t works but… how can i do that?
Thanks a lot and sorry for my english! 😉
The topic ‘[Plugin] Contact Form 7 – Change result message before submit on function error’ is closed to new replies.