-
Notifications
You must be signed in to change notification settings - Fork 92
gw-gravity-forms-rename-uploaded-files.php: Fixed an issue where renamed multi-file uploads in Nested Forms became malformed after editing the child entry.
#1160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SebastianWiz
merged 3 commits into
master
from
seb/fix/88344-nested-forms-edit-malformed
Sep 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
19305b2
`gw-gravity-forms-rename-uploaded-files.php`: Fixed an issue where re…
SebastianWiz ca817aa
`gw-gravity-forms-rename-uploaded-files.php`: Fixed an issue where re…
SebastianWiz 705aa40
`gw-gravity-forms-rename-uploaded-files.php`: Fixed an issue where re…
SebastianWiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
| * + add a prefix or suffix to file uploads | ||
| * + include identifying submitted data in the file name like the user's first and last name | ||
| * | ||
| * @version 2.6 | ||
| * @version 2.7 | ||
| * @author David Smith <[email protected]> | ||
| * @license GPL-2.0+ | ||
| * @link http://gravitywiz.com/rename-uploaded-files-for-gravity-form/ | ||
|
|
@@ -98,11 +98,23 @@ function rename_uploaded_files( $entry, $form ) { | |
|
|
||
| $result = rename( $file, $renamed_file ); | ||
|
|
||
| $renamed_files[] = $this->get_url_by_path( $renamed_file, $form['id'] ); | ||
|
|
||
| $renamed_url = $this->get_url_by_path( $renamed_file, $form['id'] ); | ||
| $renamed_files[] = $renamed_url; | ||
|
|
||
| // Keep Gravity Forms file-path meta in sync with the renamed URL. | ||
| $root = GF_Field_FileUpload::get_upload_root_info( $form['id'] ); | ||
| gform_update_meta( | ||
| $entry['id'], | ||
| GF_Field_FileUpload::get_file_upload_path_meta_key_hash( $renamed_url ), | ||
| array( | ||
| 'path' => trailingslashit( $root['path'] ), | ||
| 'url' => trailingslashit( $root['url'] ), | ||
| 'file_name' => wp_basename( $renamed_url ), | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| // In cases where 3rd party add-ons offload the image to a remote location, no images can be renamed. | ||
| // In cases where 3rd party add-ons offload the image to a remote location, nfo images can be renamed. | ||
| if ( empty( $renamed_files ) ) { | ||
| continue; | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.