【发布时间】:2015-09-18 11:08:07
【问题描述】:
我正在使用联系表格 7 提交表格并使用 wpcf7_before_send_mail 通过soap 客户端生成参考号。
代码是
function wpcf7_do_something($WPCF7_ContactForm)
{
if (3490 == $WPCF7_ContactForm->id()) {
$client = new SoapClient('http://xxx.xxx.xxx.xxx:xxxxx/4dwsdl', array('trace' => 1));
$res_date = date("Y-m-d", strtotime('01 feb 2015'));
$enquiry_id = $client->__call('WS_AddContact',
array(
'narwal Devender',
null,
'Devender',
'narwal',
'hisar',
'Hisar',
'Haryana',
'125001',
'Australia',
'01662246138',
'9802260750',
'8529000369',
'vijaylal@webmastershisar.com',
true,
'google',
'google',
'Phone Call',
0,
'type of good should be strode.',
$res_date,
'2 to 6 Months',
'SSPSS',
null,//array('xxxxxxx'),
array('46.75'),
array('1 x 1 x 1 (1qm)'),
array('xxxxxxxxx'),
array('send print should be here to work.'),
null,
'xxxxxxxxxxxxx',
null
)
);
mail('vijaylal@webmastershisar.com', 'My Subject', $enquiry_id);
}
return $wpcf7;
}
这工作正常并正在发送电子邮件。
但我想在感谢页面或任何页面上向自定义显示查询 ID,或者通过使用一些重定向并将数据发送到 url。
我也在尝试在 wpcf7_mail_sent 中使用此代码,这也可以,
但是当我尝试使用重定向时,它什么也不做,并且联系表格只是挂起。
add_action('wpcf7_mail_sent', 'wpcf7_redirect_on_submit');
function wpcf7_redirect_on_submit($wpcf7)
{
header( 'Location: http://www.google.com' );
exit;
}
如何在不使用 javascript 或 jQuery on_sent_ok 的情况下重定向 wpcf7_mail_sent 中的联系表单?
或
如何在页面上向用户显示此查询 ID?
任何人都可以帮助完成这项工作。
【问题讨论】:
标签: php wordpress soap-client contact-form