• Resolved yepecece

    (@yepecece)


    Hi,

    I am trying to modify the email message for an email action via the ninja_forms_run_action_settings filter.

    Here is my code:

    add_filter('ninja_forms_run_action_settings', 'sg_download_nf_success_message', 11, 4);
    function sg_download_nf_success_message($action_settings, $form_id, $action_id, $form_settings) {
    	if($form_id == 1 && $action_id = 2) {
    	$subject_message = get_field( 'subject_message', 'option' );
    	$form_message = get_field( 'form_message', 'option' );
    	$action_settings['email_subject'] = $subject_message;
    	$action_settings['email_message'] = $form_message;
    	}
    	return $action_settings;
    }

    The problem is that this alters all messages and subjects for all my email action.
    How can I target the ['email_subject'] and ['email_message'] for a specific action.

    Or is there a way to add acf fields (from an option page) via the merge tags in the ninja forms interface?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Justin McElhaney

    (@jmcelhaney)

    adding ACF information to the fields, you would need to know the meta key for how the data is stored in the post meta or user meta database tables. You could then use the merge tags {user_meta:YOUR_META_KEY} and {post_meta:YOUR_META_KEY} to recall the data from ACF using the corresponding meta key.

Viewing 1 replies (of 1 total)

The topic ‘Modify email message programatically’ is closed to new replies.