Skip to content

Instantly share code, notes, and snippets.

@spivurno
Last active November 10, 2021 19:39
Show Gist options
  • Save spivurno/8b42143282c0fbec54e8c18de5124809 to your computer and use it in GitHub Desktop.
Save spivurno/8b42143282c0fbec54e8c18de5124809 to your computer and use it in GitHub Desktop.
Gravity Perks // Easy Passthrough // Edit Entry
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gp-easy-passthrough/gpep-edit-entry.php
*/
/**
* Gravity Perks // Easy Passthrough // Edit Entry
*
* Edit entry ID specified in field with current form submission.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
* @copyright 2019 Gravity Wiz
*/
// Update "123" with your form ID.
add_filter( 'gform_entry_id_pre_save_lead_123', 'my_update_entry_on_form_submission', 10, 2 );
function my_update_entry_on_form_submission( $entry_id, $form ) {
if ( is_callable( 'gp_easy_passthrough' ) ) {
$session = gp_easy_passthrough()->session_manager();
$update_entry_id = $session[ gp_easy_passthrough()->get_slug() . '_' . $form['id'] ];
}
return isset( $update_entry_id ) && $update_entry_id ? $update_entry_id : $entry_id;
}
@spivurno
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment