Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cdchris12/44e187cd851c4e0d14c9e0feb3f60b4e to your computer and use it in GitHub Desktop.
Save cdchris12/44e187cd851c4e0d14c9e0feb3f60b4e to your computer and use it in GitHub Desktop.
GravityView - Trigger the `gform_after_submission` action when an entry is edited, but ONLY for Form #20.
<?php
/**
* GravityView doesn't trigger the `gform_after_submission` action when editing entries. This does that,
* but ONLY FOR FORM #20.
*
* @param array $form
* @param int $entry_id ID of the entry being updated
* @param GravityView_Edit_Entry_Render $object
*
* @return void
*/
function gravityview_trigger_gform_after_submission_form_20( $form = array(), $entry_id = array(), $object ) {
// Only trigger for Form ID #20; else return
if( 20 == (int) $form['id'] ) {
gf_do_action( array( 'gform_after_submission', $form['id'] ), $object->entry, $form );
} else {
return;
}
}
add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_gform_after_submission_form_20', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment