feat: opt-in ALTCHA with global + per-form settings#1
Merged
Conversation
Previously the plugin protected every Gravity Form by default (opt-out), configurable only through the `should_protect` filter. This adds a Gravity Forms add-on exposing the configuration as admin UI and flips the default to opt-in: - Global "Enable for all forms" toggle (Forms → Settings → ALTCHA), off by default. - Per-form "Enable ALTCHA for this form" toggle (form Settings → ALTCHA tab). A form is protected when the global toggle is on, or that form's own toggle is on. The `genero/gravityforms_altcha/should_protect` filter still overrides the saved settings for programmatic control. Bumps version to 0.2.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Makes ALTCHA protection opt-in with admin UI, instead of protecting every Gravity Form by default.
Previously the plugin was opt-out — every form was protected, configurable only via the
should_protectfilter. This adds a Gravity Forms add-on (GFAddOn) that surfaces the configuration as admin settings and flips the default:A form is protected when the global toggle is on or that form's own toggle is on (
Settings::isEnabledForForm()). Thegenero/gravityforms_altcha/should_protectfilter still overrides the saved settings for programmatic control.Version bumped to 0.2.0.
This flips the default from opt-out to opt-in. After upgrading, no form is protected until a toggle is enabled. Sites relying on universal coverage should turn on "Enable for all forms" after updating.
Changes
src/Settings.php(new) —GFAddOnwith global + per-form toggle fields and theisEnabledForForm()resolver.src/Plugin.php— register the add-on ongform_loaded; version → 0.2.0.src/Integration.php—shouldProtect()now defaults to the saved settings instead of hardcodedtrue.README.md— documents the settings and the filter's new role as an override.Testing
Verified against a live WordPress + Gravity Forms 2.9 install:
php -lclean, Pint passes, 6/6 PHPUnit unit tests pass.verifySolution(), and no widget rendered when a form has ALTCHA disabled.🤖 Generated with Claude Code