-
Notifications
You must be signed in to change notification settings - Fork 41
New spam settings section in form settings #3179
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
Crabcyborg
merged 13 commits into
master
from
new_spam_settings_section_in_form_settings
Jul 14, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
96ae45a
Add a new spam settings section to form settings
Crabcyborg e3a7088
Move styles to scss
Crabcyborg 7e4a5ac
Insert the captcha field before the submit button, use vanilla JS
Crabcyborg 474a72b
Add a new view to re-use HTML
Crabcyborg 2a311a4
Add a new view to re-use HTML
Crabcyborg 53c493e
Fix since versions
Crabcyborg 79522a9
Run fixers, fix issue with p styling
Crabcyborg c953d1e
Use early exit, properly deprecate function
Crabcyborg 692b42a
Fix warning visiblity issue
Crabcyborg 3ab2970
Add the field creation logic for captcha in a safer way
Crabcyborg 8dbcb4a
Merge branch 'master' into new_spam_settings_section_in_form_settings
Crabcyborg 4eec840
Merge branch 'master' into new_spam_settings_section_in_form_settings
Crabcyborg 93a0de1
Merge branch 'master' into new_spam_settings_section_in_form_settings
Crabcyborg 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
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
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
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 |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| <?php | ||
| /** | ||
| * Spam settings for form | ||
| * | ||
| * @since x.x | ||
| * | ||
| * @package Formidable | ||
| * | ||
| * @var array $values Form values. | ||
| */ | ||
|
|
||
| if ( ! defined( 'ABSPATH' ) ) { | ||
| die( 'You are not allowed to call this page directly.' ); | ||
| } | ||
|
|
||
| $frm_settings = FrmAppHelper::get_settings(); | ||
| $view_dir_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/'; | ||
|
|
||
| ?> | ||
| <div class="frm-spam-settings"> | ||
| <p class="howto"> | ||
| <?php esc_html_e( 'Prevent spam submissions with anti-spam tools.', 'formidable' ); ?> | ||
| </p> | ||
|
|
||
| <?php | ||
| if ( function_exists( 'akismet_http_post' ) ) { | ||
| include $view_dir_path . 'akismet.php'; | ||
| } | ||
|
|
||
| include $view_dir_path . 'stopforumspam.php'; | ||
| include $view_dir_path . 'antispam.php'; | ||
| ?> | ||
|
|
||
| <?php | ||
| // Check if captcha is configured | ||
| $captcha_settings = FrmCaptchaFactory::get_settings_object(); | ||
| $captcha_configured = $captcha_settings->has_pubkey(); | ||
|
|
||
| // Check if form has a captcha field | ||
| $form_fields = FrmField::get_all_for_form( $values['id'], '', 'exclude' ); | ||
| $has_captcha_field = false; | ||
| $captcha_field_id = 0; | ||
|
|
||
| foreach ( $form_fields as $field ) { | ||
| if ( 'captcha' === $field->type ) { | ||
| $has_captcha_field = true; | ||
| $captcha_field_id = $field->id; | ||
| break; | ||
| } | ||
| } | ||
| ?> | ||
|
|
||
| <p class="frm8 frm_form_field"> | ||
| <input type="hidden" name="frm_include_captcha" value="0" /> | ||
| <label for="frm_include_captcha" class="frm_inline_block"> | ||
| <input type="checkbox" id="frm_include_captcha" name="frm_include_captcha" value="1" <?php disabled( $captcha_configured, false ); ?> <?php checked( $has_captcha_field, true ); ?> /> | ||
| <?php esc_html_e( 'Include Captcha in this form', 'formidable' ); ?> | ||
| </label> | ||
| </p> | ||
|
|
||
| <?php if ( ! $captcha_configured ) : ?> | ||
| <div class="frm_warning_style frm_force_visible_warning"> | ||
| <span> | ||
| <?php | ||
| printf( | ||
| /* translators: %1$s: Opening anchor tag, %2$s: Closing anchor tag */ | ||
| esc_html__( 'To enable Captcha, first set up a Captcha service in %1$sGlobal Spam Settings%2$s.', 'formidable' ), | ||
| '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=captcha_settings' ) ) . '">', | ||
| '</a>' | ||
| ); | ||
| ?> | ||
| </span> | ||
| </div> | ||
| <?php else : ?> | ||
| <div id="frm_captcha_add_warning" class="frm_warning_style" style="display: none;"> | ||
| <span><?php esc_html_e( 'A Captcha field will be added to this form when you save settings.', 'formidable' ); ?></span> | ||
| </div> | ||
| <div id="frm_captcha_remove_warning" class="frm_warning_style" style="display: none;"> | ||
| <span><?php esc_html_e( 'The Captcha field will be removed from this form when you save settings.', 'formidable' ); ?></span> | ||
| </div> | ||
| <?php endif; ?> | ||
|
|
||
| <h3><?php esc_html_e( 'Global Spam Settings', 'formidable' ); ?></h3> | ||
|
|
||
| <p class="howto"> | ||
| <?php esc_html_e( 'Managed in Global Settings and applied to every form.', 'formidable' ); ?> | ||
| </p> | ||
|
|
||
| <table class="form-table frm-fields frm-global-spam-table"> | ||
| <tr> | ||
| <td> | ||
| <?php FrmHtmlHelper::show_readonly_setting_icon( $frm_settings->honeypot ); ?> | ||
| <?php esc_html_e( 'Use honeypot to check entries for spam', 'formidable' ); ?> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| <?php FrmHtmlHelper::show_readonly_setting_icon( $frm_settings->wp_spam_check ); ?> | ||
| <?php esc_html_e( 'Use WordPress spam comments to check entries for spam', 'formidable' ); ?> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| <?php FrmHtmlHelper::show_readonly_setting_icon( $frm_settings->denylist_check ); ?> | ||
| <?php esc_html_e( 'Check denylist data to validate for spam', 'formidable' ); ?> | ||
| </td> | ||
| </tr> | ||
| </table> | ||
|
|
||
| <p> | ||
| <?php | ||
| printf( | ||
| /* translators: %1$s: Opening anchor tag, %2$s: Closing anchor tag */ | ||
| esc_html__( 'To change these values %1$svisit Global Spam Settings%2$s', 'formidable' ), | ||
| '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=captcha_settings' ) ) . '" target="_blank">', | ||
| '</a>' | ||
| ); | ||
| ?> | ||
| </p> | ||
| </div> |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Oops, something went wrong.
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.