GravityEdit: How to trigger Gravity Forms actions when updating a field value

The information below does not apply to form notifications. To send a form notification, please read: How to trigger form notifications when editing with GravityEdit.

On the GravityEdit plugin, when you update a field value, it doesn't trigger the standard Gravity Forms "Entry Updated" action. That's because when you're updating 10 fields for 10 entries, that could lead to 100 emails!

But sometimes you want to turn on Gravity Forms actions. To do that, GravityEdit has a filter: gravityview-inline-edit/remove-gf-update-hooks, the default is true.

To trigger Gravity Forms actions when updating fields, add this code:

add_filter( 'gravityview-inline-edit/remove-gf-update-hooks', '__return_false' );

Adding the code snippet above will once again trigger the following hooks:

  • gform_entry_pre_update
  • gform_form_pre_update_entry
  • gform_form_pre_update_entry_{$form_id}
  • gform_post_update_entry
  • gform_post_update_entry_{$form_id}

Before you use this code:

  • If you are not sure how to add custom code to your theme, please take a look at this article.
  • The code samples below target specific forms by their ID. In those examples, it's the ID 100. Please change that to the specific form ID connected to your View.

When using the MailChimp Add-On

add_filter( 'gravityview-inline-edit/entry-updated', 'gravityview_inline_edit_trigger_update_actions', 10, 5 );

function gravityview_inline_edit_trigger_update_actions( $update_result, $entry = array(), $form_id = 0, $gf_field = null, $original_entry = array() ) { 
	
        if ( 100 !== (int) $form_id ) { // replace 100 with your form ID
		return $update_result;
	}
	
	$form = GFAPI::get_form( $form_id );
	
	if ( function_exists( 'gf_mailchimp' ) ) {
		add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
		gf_mailchimp()->maybe_process_feed( $entry, $form );
		remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
	}		
		
    return $update_result;
}

Priority is set to something unlikely to be used by other codes (1294873). Feel free to use a different priority.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us