Repository navigation
Offer the import instead of waiting to be found - #11
Merged
Merged
Conversation
An importer nobody finds is an importer nobody uses, and the moment it is worth the most is the one nobody goes looking for it: just after activating this plugin on a site that already has fifteen forms in another one. So the plugin looks for them itself and says so -- "AllTerrain Forms found 6 forms in Contact Form 7" -- with one button that brings all of them over, from every source at once. Three rules keep that from becoming the kind of notice people install other plugins to hide. It appears only where it is relevant: this plugin's screens and the Plugins screen, where an activation lands. "Not now" is remembered per user, for good, because one administrator dismissing it must not answer for the person who actually built those forms. And it stops offering the moment anything has been imported -- by then the Import page is somewhere you go, not something that asks. The survey behind it costs a query per source, so it is cached for twelve hours and forgotten whenever a form is imported or a plugin is switched on or off. `atf_show_import_notice` turns the whole thing off for a site that would rather introduce it its own way. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Yes — and it should have worked this way from the start. An importer nobody finds is an importer nobody uses, and the moment it is worth the most is the one nobody goes looking for it: just after activating this plugin on a site that already has fifteen forms in another one.
What it does now
The plugin looks for them itself and says so, with one button that brings all of them over — from every source at once:
With more than one source it counts them out instead, because "4 forms in other plugins" leaves you wondering which — and which is the reason you would click:
The Import page gains the same one-click button above its per-source lists (
Import all 4 forms), since somebody arriving there after switching plugins usually wants all of it; picking through the lists is the exception.What keeps it from being the kind of notice people install plugins to hide
atf_show_import_noticeturns the whole thing off for a site that would rather introduce it its own way.Cost of the detection
Answering "is there anything to import" costs a query per source, plus a
SHOW TABLESfor Gravity Forms, and it is asked on ordinary admin page loads. So the survey is cached for twelve hours and dropped whenever it could be wrong: a form imported, or a plugin activated or deactivated.atf_import_all()takes the importer ids once up front rather than re-reading the survey inside its loop — each successful import invalidates the cache, so re-reading would re-run every source's query for every form.Verified against your real site
Rendered on the 8889 site through the actual
admin_noticespath, with its own data:That run is also what caught the copy bug in my first draft, which said "in other plugins" even when every form came from one.
11 new PHPUnit tests (567 green): counts per source with empty sources omitted; the cache holding and being dropped;
atf_import_all()taking everything from two sources at once and leaving both originals untouched; and the notice decision asserted from both sides — shown when forms exist, silent when dismissed (and still shown to a different administrator), silent after the first import, silent without the capability, silent behind the filter, and on the right screens only. PHPCS: 0 errors.readme.txtanddocs/hooks-reference.mdupdated for the new behaviour and filter.🤖 Generated with Claude Code
https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp