From 1fbe5fb82285b35c76568335dd5e7b43675c0119 Mon Sep 17 00:00:00 2001 From: Saif Sultan Date: Wed, 20 Nov 2024 23:28:54 +0530 Subject: [PATCH] `gpnf-gv-auto-approve-child-entries-with-parent-entry.php`: Added snippet to auto approve nested entries when parent entry is approved. --- ...pprove-child-entries-with-parent-entry.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gp-nested-forms/gpnf-gv-auto-approve-child-entries-with-parent-entry.php diff --git a/gp-nested-forms/gpnf-gv-auto-approve-child-entries-with-parent-entry.php b/gp-nested-forms/gpnf-gv-auto-approve-child-entries-with-parent-entry.php new file mode 100644 index 000000000..0c88e02fc --- /dev/null +++ b/gp-nested-forms/gpnf-gv-auto-approve-child-entries-with-parent-entry.php @@ -0,0 +1,28 @@ +id ] ); + $nested_entries = array_merge( $nested_entries, $_entries ); + } + } + + foreach ( $nested_entries as $nested_entry_id ) { + $nested_entry = GFAPI::get_entry( $nested_entry_id ); + $nested_entry['is_approved'] = '1'; + GFAPI::update_entry( $nested_entry ); + } +}, 10, 1 );