diff --git a/gp-nested-forms/gpnf-override-parent-merge-tag-on-submission.php b/gp-nested-forms/gpnf-override-parent-merge-tag-on-submission.php index a8cf5b46a..28b44b164 100644 --- a/gp-nested-forms/gpnf-override-parent-merge-tag-on-submission.php +++ b/gp-nested-forms/gpnf-override-parent-merge-tag-on-submission.php @@ -122,6 +122,15 @@ function override_child_entry_input_value( $entry, $field, $child_form, $input_i $child_entry = GFAPI::get_entry( $child_entry_id ); $value = GFCommon::replace_variables( $default_value, $child_form, $child_entry ); GFAPI::update_entry_field( $child_entry_id, $input_id, $value ); + + // Added support to force the renaming of uploaded files if the GP File Renamer plugin is active and the version is greater than 1.0.9 because `rename_uploaded_files` method of `GP_File_Renamer` class supports third argument `force` only after 1.0.9. + if ( function_exists( 'gp_file_renamer' ) && defined( 'GP_FILE_RENAMER_VERSION' ) && version_compare( GP_FILE_RENAMER_VERSION, '1.0.9', '>' ) ) { + // Get the updated child entry to rename the uploaded files. + $child_entry = GFAPI::get_entry( $child_entry_id ); + + // Force the renaming of uploaded files if set. + gp_file_renamer()->rename_uploaded_files( $child_entry, $child_form, true ); + } } }