[英]how can I filter before contact form 7 (wordpress) send email and later go back to my normal flow?
I am trying to do this: 我正在尝试这样做:
Using Contact Form 7, I want to filter depending on a selectbox and send mail to one or other , I would do this sending with phpmail function... 使用Contact Form 7,我想根据选择框进行过滤并将邮件发送到一个或其他邮件,我将使用phpmail函数进行发送...
So far I have this.. 到目前为止,我有这个。
add_action( 'wpcf7_before_send_mail', 'process_form' ); add_action('wpcf7_before_send_mail','process_form');
function process_form( $cf7 ) {
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}
if( $cf7->id() == MYID ) {
... DO something
}
}
And it works, it filters only when the ID of the form matches with MYID, but I want to return true or something and then show the normal message of "Your email has been sent" instead get stuck ont he loading gif. 而且它的工作原理是,仅当表单的ID与MYID匹配时才进行过滤,但是我想返回true或其他内容,然后显示正常的消息“您的电子邮件已发送”,而不是在加载gif时卡住了。 What kinda I do to get a "true" return or keep with the contact form 7 flow? 我怎样做才能获得“真实的”回报或保持联系表7的流程?
I obvioulsy tried with return true
; 我不愿意尝试return true
; At the "Do something" section I just send mail with mail(....")
在“做某事”部分,我只发送带有mail(....")
I could fix this , after do the functions I had to, I only had to return it as simple as with a return
我可以解决这个问题,我不得不功能后,我只需要它返回那样简单与return
In order to send more mails and do more things I am using CF7 as well and sending new parameters on this way: 为了发送更多邮件和执行更多操作,我也使用CF7并以这种方式发送新参数:
@wp_mail(....)
http://codex.wordpress.org/Function_Reference/wp_mail http://codex.wordpress.org/Function_Reference/wp_mail
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.