Flaw with Gravity Forms GF_IMPORT_FILE
I have been using Gravity Forms since 2010. I find the plugin fairly robust, though for modern day websites it is a bit bloated, loading up four CSS files and a variety of JS files per form. How many it loads actually depends on which features you use, which would be a neat solution if those files were then combined before being printed to the page.
A new (to me) feature has been the ability to automatically import forms based on a file.
You just add this to your wp-config.php file, and point the last parameter to a Gravity Forms json file (which you can generate vvia Forms > Export in the plugin’s menu.)
define( 'GF_IMPORT_FILE', 'https://arrivalapp.com/wp-content/gravityforms-import.json' );
The only problem is, though the json file does define the form’s ID, that will not necessarily persist when auto-importing. So if you have three forms in your import file, with IDs of 3, 4 and 6, when they’re imported to a new site, they’ll be reassigned IDs of 1, 2 and 3.
The major flaw with this is that if you want to do
gform_after_submission and target a specific form, this is all based on form ID. If the IDs change, you need to change your code and accommodate based on that. Which is kind of a nightmare.
Further, it’s actually very likely you will need to use
gform_after_submission, because when importing forms you can’t import feeds. Feeds, in Gravity Forms, handle everything from user registration to Stripe and so on.
I reached out to Gravity Forms support and they just sent this short message in response, so it doesn’t even sound like accommodating saving IDs is on their radar.
Maintaining the original form id when you import a form is not a feature of Gravity Forms. The id for imported forms is assigned based on the already used id’s in your installation. This has always been the case.
So id 2 for an imported form would be assigned only if id 1 was already assigned to a form in the installation.
Nor is adding feeds during imports, though it’s been requested for years. While Gravity Forms is constantly adding new add-ons, it would be great if they addressed some of these requests that have been asked for years. Kind of like how their Stripe add-on supports subscriptions, but not cancelling subscriptions.