How to append string / variable to email notification content
-
Hello,
I am looking to append a string of text (custom email signature) to the standard email notifications sent when submitting a form. I have come across the custom form mail data snippet below, however I cannot really find any documentation on it or anything really detailing the options and how it can be manipulated.
add_filter( 'forminator_custom_form_mail_data', function( $data, $custom_form, $entry ){ return $data; }, 10, 3 );
I need to be able to retrieve the custom post ID where the form is embedded, compare it with the assigned taxonomies to the CPT and then append the correct email signature (already stored in an accessible variable) to the end of the email content (E.g. after the all field data tag)
I previously was using ninja forms but am migrating away from it to your plugin. I have the conditional statements to check the taxonomies etc, I just need assistance retrieving the embedded CPT ID and appending the string to the email content
For reference the start of the ninja forms function is below and I’d be looking for the forminator alternative:
function ninja_forms_action_email_message( $message, $data, $action_settings ){ $pageid = $data['extra']['post_id']; // this is how to get the page id where the form is embedded $form_id = $data['form_id']; // the current form id $customer_form_id = get_field('customer_form', $pageid); // getting the embedded ID that was set in an ACF field for the custom post if( $customer_form_id == $form_id ) { $message .= 'this is a generic text added to ALL messages'; if (has_term('term1', 'taxonomy1', $pageid)) { $message .= $customsig1; // variable containing custom signature } // several more if statements to check and compare terms here }
Thank you
- The topic ‘How to append string / variable to email notification content’ is closed to new replies.