在发送挂钩之前联系 Form 7 设置变量
Contact Form 7 set variable before send hook
我想在提交电子邮件时设置报价编号。
这是我要设置的表单中的变量。
[隐藏的 frnum id:frnum]
在functions.php
function wpcf7_setup_quotenum($WPCF7_ContactForm) {
if ($WPCF7_ContactForm->id() == '3550') {
//Get current form
$wpcf7 = WPCF7_ContactForm::get_current();
// get current SUBMISSION instance
$submission = WPCF7_Submission::get_instance();
// Ok go forward
if ($submission) {
$_POST['frnum'] = 'test';
}
}
}
这是获取号码的电子邮件代码。
[你的名字]认为你会对这个叉车租赁报价感兴趣#:FR[frnum]
我最终会有代码将号码设置为唯一号码,我只是想在电子邮件中显示一些内容。
提前感谢您为我指明正确的方向。
对于未来的任何人,这就是我的结局:
if ($WPCF7_ContactForm->id() == '3550') {
//Get current form
$wpcf7 = WPCF7_ContactForm::get_current();
// get current SUBMISSION instance
$submission = WPCF7_Submission::get_instance();
// Ok go forward
if ($submission) {
// do some replacements in the cf7 email body
$mail = $wpcf7->prop('mail');
// Find/replace the "[frnum]" tag as defined in your CF7 email body
// and add changes name
$mail['body'] = str_replace('[frnum]', 'test', $mail['body']);
//$mail['body'] = '[frnum]' => 'test';
// Save the email body
$wpcf7->set_properties(array(
"mail" => $mail
));
// return current cf7 instance
return $wpcf7;
}
}
我想在提交电子邮件时设置报价编号。 这是我要设置的表单中的变量。
[隐藏的 frnum id:frnum]
在functions.php
function wpcf7_setup_quotenum($WPCF7_ContactForm) {
if ($WPCF7_ContactForm->id() == '3550') {
//Get current form
$wpcf7 = WPCF7_ContactForm::get_current();
// get current SUBMISSION instance
$submission = WPCF7_Submission::get_instance();
// Ok go forward
if ($submission) {
$_POST['frnum'] = 'test';
}
}
}
这是获取号码的电子邮件代码。
[你的名字]认为你会对这个叉车租赁报价感兴趣#:FR[frnum]
我最终会有代码将号码设置为唯一号码,我只是想在电子邮件中显示一些内容。
提前感谢您为我指明正确的方向。
对于未来的任何人,这就是我的结局:
if ($WPCF7_ContactForm->id() == '3550') {
//Get current form
$wpcf7 = WPCF7_ContactForm::get_current();
// get current SUBMISSION instance
$submission = WPCF7_Submission::get_instance();
// Ok go forward
if ($submission) {
// do some replacements in the cf7 email body
$mail = $wpcf7->prop('mail');
// Find/replace the "[frnum]" tag as defined in your CF7 email body
// and add changes name
$mail['body'] = str_replace('[frnum]', 'test', $mail['body']);
//$mail['body'] = '[frnum]' => 'test';
// Save the email body
$wpcf7->set_properties(array(
"mail" => $mail
));
// return current cf7 instance
return $wpcf7;
}
}