From 23bf3d157de32b57bf0b18844fea6bbf81ae81b4 Mon Sep 17 00:00:00 2001 From: Samuel Bassah Date: Mon, 30 Sep 2024 08:14:34 +0000 Subject: [PATCH] `gpnf-set-created-by-property-on-child-entries-after-user-registration.php` : Added new snippet for GP Nested Forms that sets the created by property on the child entries after user account is created. --- ...-child-entries-after-user-registration.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gp-nested-forms/gpnf-set-created-by-property-on-child-entries-after-user-registration.php diff --git a/gp-nested-forms/gpnf-set-created-by-property-on-child-entries-after-user-registration.php b/gp-nested-forms/gpnf-set-created-by-property-on-child-entries-after-user-registration.php new file mode 100644 index 000000000..a4283f162 --- /dev/null +++ b/gp-nested-forms/gpnf-set-created-by-property-on-child-entries-after-user-registration.php @@ -0,0 +1,27 @@ +get_child_entries(); + + foreach ( $child_entries as $child_entry ) { + GFAPI::update_entry_property( $child_entry['id'], 'created_by', $user_id ); + $child_entry['created_by'] = $user_id; + } +}