PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Customize confirmation email via hook?

  1. Hello - I've customized a confirmation form's html email via the gform_confirmation hook however the email confirmation that is sent is still the old hardcoded html.

    I haven't found a cooresponding gform_confirmation_email (or similar) hook. Is there a way to get the email output to look like the customized html I'm using for the form confirmation itself?

    Thanks

    Posted 11 years ago on Thursday October 4, 2012 | Permalink
  2. Please explain how the form confirmation and the form HTML are different, or the same.

    For Gravity Forms, we normally talk about a few different things.

    1. Form: this is the output of the gravityforms shortcode and shown to your website's visitors
    2. Confirmation: this is shown after a successful form submission. It can be text, load a page of your site, or redirect to another URL
    3. Admin notification: this is configured on the top half of the notifications screen
    4. User notification: this is configured on the bottom half of the notifications screen. Also referred to as the autoresponder

    I'm wondering which you were successful at changing, with which hook, and what you would like to change next? Maybe you are looking to modify the AutoResponder?

    Posted 11 years ago on Saturday October 6, 2012 | Permalink
  3. Sorry - I see I put an extra word in my original question making it confusing.

    We've successfully customized the Confirmation Page that is displayed after successful form submission. We accomplished this via custom HTML generated at time of the gform_confirmation hook.

    However, the problem is with the corresponding email that is sent to the user submitting the form -- that HTML we have not been able to find a way to change.

    Posted 11 years ago on Sunday October 7, 2012 | Permalink
  4. You can edit the user notification on the notifications page. Have you already tried that? Or are you using the {all_fields} helper, and trying to change the look of that?

    You can't change the output of the {all_fields} helper. If you want, you can craft your own HTML notification in the user notification area. Enter your own HTML and insert the proper merge tags.

    Were you unsuccessful in doing that, or does that not work in your situation?

    Posted 11 years ago on Sunday October 7, 2012 | Permalink
  5. We need custom HTML with conditional logic so simple templating does not work. We have achieved this via the gform_confirmation hook for the form confirmation page.

    However, for the corresponding email that is sent to the user, the original Gravity Forms HTML is sent -- we need our customized HTML to be sent instead.

    Posted 11 years ago on Sunday October 7, 2012 | Permalink
  6. The user notification area supports conditional shortcodes:
    http://www.gravityhelp.com/documentation/page/Shortcodes#Conditional_Shortcode

    So you can use conditional logic there if you need to do something other than {all_fields} and have more complex requirements.

    If that does not work for you, you can completely change the user notification using the gform_pre_submission_filter. Here is an example of how to use it:

    [php]
    <?php
    // change 19 to your form ID
    add_filter('gform_pre_submission_filter_19', 'conditional_message');
    function conditional_message($form){
    
    	// update the "3" following "input_" to the ID of your field
    	$value1 = rgpost('input_3');
    
    	// I append my conditional text to the autoResponder (user notification) which is already set up in the form builder
    	switch($interest) {
    		case 'beltguard':
    			$form['autoResponder']['message'] .= "Interest: Belt Guards</p>";
    			break;
    		case 'safetyguard':
    			$form['autoResponder']['message'] .= "Interest: Safety Guards</p>";
    			break;
    		case 'catalogue':
    			$form['autoResponder']['message'] .= "Interest: Catalogue</p>";
    			break;
    	}
    
    	// return modified form
    	return $form;
    }

    Documentation: http://www.gravityhelp.com/documentation/page/Gform_pre_submission_filter

    Posted 11 years ago on Monday October 8, 2012 | Permalink