Skip to content

Commit 06ed211

Browse files
authored
gpep-update-other-form-entry-by-ep-token.php: Improved snippet to support post entry update actions.
1 parent 88d4192 commit 06ed211

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
*
2929
* 4. Install and configure this snippet per the inline instructions.
3030
*/
31-
// Update "123" to the form ID that should trigger an update to the other form's entry.
32-
add_action( 'gform_after_submission_123', function( $entry, $form ) {
3331

32+
// Update "123" to the form ID that should trigger an update to the other form's entry.
33+
add_action( 'gform_after_submission_123', function ( $entry, $form ) {
3434
// Update "4" to the ID of the field that is populated with the EP token.
3535
$token_field_id = 4;
3636

@@ -43,7 +43,8 @@
4343
$token = $entry[ $token_field_id ];
4444
$source_entry = gp_easy_passthrough()->get_entry_for_token( $token );
4545
if ( $source_entry ) {
46-
GFAPI::update_entry_field( $source_entry['id'], $target_field_id, $update_value );
46+
$source_entry[ $target_field_id ] = $update_value;
47+
GFAPI::update_entry( $source_entry );
4748
}
4849

4950
}, 10, 2 );

0 commit comments

Comments
 (0)