From 0a4a8f0edead468edd2ef67db575a77a7ca26b10 Mon Sep 17 00:00:00 2001 From: Malay Ladu Date: Fri, 28 Mar 2025 21:44:39 +0530 Subject: [PATCH] `gpep-update-other-form-entry-by-ep-token.php`: Improved snippet to support post entry update actions. --- .../gpep-update-other-form-entry-by-ep-token.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php b/gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php index e78cb9d41..63f036fe0 100644 --- a/gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php +++ b/gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php @@ -28,9 +28,9 @@ * * 4. Install and configure this snippet per the inline instructions. */ -// Update "123" to the form ID that should trigger an update to the other form's entry. -add_action( 'gform_after_submission_123', function( $entry, $form ) { +// Update "123" to the form ID that should trigger an update to the other form's entry. +add_action( 'gform_after_submission_123', function ( $entry, $form ) { // Update "4" to the ID of the field that is populated with the EP token. $token_field_id = 4; @@ -43,7 +43,8 @@ $token = $entry[ $token_field_id ]; $source_entry = gp_easy_passthrough()->get_entry_for_token( $token ); if ( $source_entry ) { - GFAPI::update_entry_field( $source_entry['id'], $target_field_id, $update_value ); + $source_entry[ $target_field_id ] = $update_value; + GFAPI::update_entry( $source_entry ); } }, 10, 2 );