-
Notifications
You must be signed in to change notification settings - Fork 92
gpnf-override-parent-merge-tag-on-submission.php: Added support to rename uploaded files in child entries.
#1035
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
gpnf-override-parent-merge-tag-on-submission.php: Added support to rename uploaded files in child entries.
#1035
Conversation
7ea0075 to
f85e8b2
Compare
gp-nested-forms/gpnf-override-parent-merge-tag-on-submission.php
Outdated
Show resolved
Hide resolved
…rename uploaded files in child entries.
f85e8b2 to
c62ed0b
Compare
WalkthroughThis change adds a conditional branch to the Changes
Sequence Diagram(s)sequenceDiagram
participant Submission as Submission Data
participant ParentMergeTags as GPNF_Override_Parent_Merge_Tags
participant FileRenamer as GP_File_Renamer
participant ChildEntry as Child Entry
Submission->>ParentMergeTags: Submit child entry data
ParentMergeTags->>ParentMergeTags: Check GP File Renamer plugin status and version
alt Plugin active and version >1.0.9
ParentMergeTags->>ChildEntry: Retrieve updated child entry
ParentMergeTags->>FileRenamer: Call rename_uploaded_files(force:true)
else Plugin inactive or version <=1.0.9
ParentMergeTags->>Submission: Continue without renaming
end
Suggested Reviewers
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
gp-nested-forms/gpnf-override-parent-merge-tag-on-submission.php (1)
125-133: Well-implemented support for file renaming when parent form values changeThe implementation correctly addresses the requirement to rename uploaded files in child entries when parent form values change. Good job on including version checking to ensure compatibility with the GP File Renamer plugin, and clearly explaining in the comment why version 1.0.9 specifically is required.
Consider adding a brief explanation of what the "force" parameter does in
rename_uploaded_files()to improve future maintainability. For example:- // Force the renaming of uploaded files if set. + // Force the renaming of uploaded files even if they were previously renamed, ensuring they reflect the updated parent form values.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2849364535/78123
Related PR: https://github.com/gravitywiz/gp-file-renamer/pull/22
Summary
The customer has a nested form with an Upload field. They are using the
{Parent}merge tag in a field, and then using this in GPFR to name the uploaded file, based on a value in the parent form.However, they want it so if the user changes the value on the parent form before submitting, the uploaded file is renamed.