Customize Email Body
-
We are using this hook to customize the email body using PHP:
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);
I can display a single field like the
First Name
without issues like so:$f-name = $form_data['first_name'];
But this doesn’t work for checkbox lists. What’s the proper way to fetch checked values in a checkbox list field?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Customize Email Body’ is closed to new replies.