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.

Send confirmation email to client after entries have been reviewed and approved

  1. Hi.

    I have client that wants a buffet booking system on his website.
    When a customer has booked a certain buffet via the website the owner of the site wants to go through the entries and confirm them before a receipt is sent out to the customer.

    Therefore, what I am after is some sort of function inside the admin area for an entry, where after reviewing the booking, the administrator can click on a button and send out a confirmation email to the customer.

    I assume this is not a built-in feature in GF, but would it be possible to do this using the API, so I would't have to hack the core?
    Any ideas or help on this matter will be much appreciated. :-)
    Vayu

    Posted 13 years ago on Monday May 2, 2011 | Permalink
  2. It's not a built in feature as you guessed, but there are plenty of API hooks that would allow you to add this type of functionality. All of the hooks/filters are documented in the Developer Documentation area of the Documentation here:

    http://www.gravityhelp.com/documentation/page/Developer_Docs

    Hooks for adding elements to the Entry Detail page are going to be under the Administration hooks.

    Posted 13 years ago on Monday May 2, 2011 | Permalink
  3. That sounds great, thanks Carl! :-)

    I see that the "gform_entry_info" hook will be an appropriate one to look at for starters.

    Vayu

    Posted 13 years ago on Monday May 2, 2011 | Permalink
  4. I have now coded a way to send a confirmation email from the admin entry page. I will share it here in case others might need this function. :-)

    // ------------------------------------------------------------------------------------
    // ------------------------------------------------------------------------------------
    /**
    * Gravity form - add a send confirmation email to entry admin panel.
    */
    add_action("gform_entry_info", "confirmation_button", 10, 2);
    function confirmation_button($form_id, $lead) {
    
        if(!class_exists("GFEntryDetail"))
    		require_once(GFCommon::get_base_path() . "/entry_detail.php");
    
    	if(!class_exists("RGFormsModel"))
    		require_once(GFCommon::get_base_path() . "/forms_model.php");
    
    	if(!class_exists("GFCommon"))
    		require_once(GFCommon::get_base_path() . "/common.php");
    
    	if( class_exists("RGFormsModel") && class_exists("GFCommon") ) { ?>
    
    		<h4>Send email</h4>
    		<p>Send a confirmation email to the user</p>
    		<input type="submit" name="send_admin_notification" value="<?php _e("Send to user", "gravityforms") ?>" class="button" style="width:100px;" onclick="jQuery('#action').val('send_user_notification');"/>
    
    		<?php
    
    		if( isset($_POST['action']) && trim($_POST['action']) === 'send_user_notification' ) {
    
    			// Initiate the form
    			$form = RGFormsModel::get_form_meta($form_id);
    
    			// The AutoResponder is not activated in the admin, so activate it here by giving it the ID number of the email field.
    			$form["autoResponder"]['toField'] = 31;
    
    			// Send an email to the user
    			GFCommon::send_user_notification($form, $lead);
    
    			// Send email to the admin
    			//GFCommon::send_admin_notification($form, $lead);
    
    			echo '<p>The email has been sendt.</p>';
    
    		}
    
    	}
    
    }

    If there is a better way to do this I am certainly open for suggestions.

    Vayu

    Posted 13 years ago on Thursday May 26, 2011 | Permalink

This topic has been resolved and has been closed to new replies.