Php 操纵忍者表单邮件正文
如何根据用户的输入操作ninja forms 3邮件正文 例如: 用户填写zipcode字段,我不想将数据添加到最近存储的邮件正文中 我找到的唯一有用的过滤器是忍者表单提交数据。但它只返回字段ID和用户输入 我需要的是一个字段键,以便我可以将其用作参考 有一个名为ninja_forms_action_email_message的过滤器,可用于定制电子邮件正文。源代码是 过滤器有三个参数: $message这是当前电子邮件正文的HTML字符串 $data表单数据包括有关表单和用户提交的数据 $action\u设置参数用于将电子邮件发送到地址等。 例如:Php 操纵忍者表单邮件正文,php,ninja-forms,Php,Ninja Forms,如何根据用户的输入操作ninja forms 3邮件正文 例如: 用户填写zipcode字段,我不想将数据添加到最近存储的邮件正文中 我找到的唯一有用的过滤器是忍者表单提交数据。但它只返回字段ID和用户输入 我需要的是一个字段键,以便我可以将其用作参考 有一个名为ninja_forms_action_email_message的过滤器,可用于定制电子邮件正文。源代码是 过滤器有三个参数: $message这是当前电子邮件正文的HTML字符串 $data表单数据包括有关表单和用户提交的数据 $ac
function custom_email_body_content($message, $data, $action_settings) {
// You may want to check if the form needs to be customised here
// $data contains information about the form that was submitted
// Eg. if ($data[form_id]) === ...
// Convert the submitted form data to an associative array
$form_data = array();
foreach ($data['fields'] as $key => $field) {
$form_data[$field['key']] = $field['value'];
}
// Do something to the email body using the value of $form_data['zipcode']
// Maybe a str_replace of a token, or generate a new email body from a template
// Return the modified HTML email body
return $message;
}
add_filter('ninja_forms_action_email_message', 'custom_email_body_content', 10, 3);
有一个名为ninja_forms_action_email_message的过滤器,可用于自定义电子邮件正文。源代码是
过滤器有三个参数:
$message这是当前电子邮件正文的HTML字符串
$data表单数据包括有关表单和用户提交的数据
$action\u设置参数用于将电子邮件发送到地址等。
例如:
function custom_email_body_content($message, $data, $action_settings) {
// You may want to check if the form needs to be customised here
// $data contains information about the form that was submitted
// Eg. if ($data[form_id]) === ...
// Convert the submitted form data to an associative array
$form_data = array();
foreach ($data['fields'] as $key => $field) {
$form_data[$field['key']] = $field['value'];
}
// Do something to the email body using the value of $form_data['zipcode']
// Maybe a str_replace of a token, or generate a new email body from a template
// Return the modified HTML email body
return $message;
}
add_filter('ninja_forms_action_email_message', 'custom_email_body_content', 10, 3);
@您可以将您的子主题函数.phpfile@GuilhermeRossato您可以将您的子主题函数放入.php文件中