Filter/Action Hooks

If you need or want to modify the Notification message before it is sent, use the following example WP filter:

// string $message, body of message containing field ID: data
// array $fields, holds $fields[fieldID] => data
// string $notify, text from tiny_mce editor option
// string $style, contains html header with style element and css

function modify_notify_message ($message, $fields, $notify, $style) {

     $message = str_ireplace('NAME', 'FULL NAME', $message);
     $message = str_ireplace('EMAIL', 'EMAIL ADDRESS', $message);

     return $message;
}
add_filter('kk_notify_message', 'modify_notify_message', 99, 4);

 

Use a priority of 11 or greater in this filter.  The content of the $message can vary depending on options you have selected.

This filter is part of the Divi theme.  It is included here for use in modifying the wp_mail header array.

apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email, $notification_msg ) );

This filter is discussed on the Errata page but is primarily used to customize the file type option list for the KK File Upload field type.

This action hook allows the captured field data to be used outside the processing of the form itself.

//passed to function -
//array $fields - contains $fields[field_id] => value (fields set to record to flamingo)
//array $args - contains $args[arg] => value which represent the non-field meta within flamingo
//string $form_id
function my_function($fields, $args, $form_id) {
//do something
}
add_action('kk_cust_form_cap', 'my_function, 11, 3 );

When using the Confirmation Email feature, it should be understood that there may be some situations that the designer will need to provide additional CSS considering that the email message will be transmitted as html to the email client.

Custom Form/CRM provides minimal styling, yet, includes all Custom CSS provided through the Theme Customizer and Divi’s Theme Options Custom CSS.  The kk_conf_style filter provides the means to augment or completely change what is delivered.  As an example, the following would represent one possibility of using the filter:

//passed to function -
//array $style - contains a string of html and style elements 
function kk_conf_style_filter($style) {
$style_tmp = $style;
if(strpos($style_tmp, '/* From Custom CSS */')) {
$style_tmp = substr_replace($style_tmp, file_get_contents(get_template_directory() . '/style-static.min.css'), strpos($style_tmp, '/* From Custom CSS */'), 0);
}
return $style_tmp;
}
add_filter('kk_conf_style', 'kk_conf_style_filter');

The above locates where the Custom CSS begins and inserts the Divi static CSS file. This is one example and is not necessarily recommended, but if a Page is selected to serve as the content for the email body, then Builder styling will need to be provided.

For Custom CSS entries, the class “confirmation” has been added to theelement to aid in defining CSS specific to Confirmation emails.