Created
January 13, 2026 15:04
-
-
Save techjewel/e6bf22ce3edb99719a7606a8435715fe to your computer and use it in GitHub Desktop.
A Simple Code Snippet to check if the provided email in FluentForms submission is a CRM contact and is in a block lists tags.
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
| <?php | |
| /** | |
| * A Simple Code Snippet to check if the provided email in FluentForms submission is a CRM contact and is in a block lists tags. | |
| * If yes, then it will reject the form submission | |
| */ | |
| add_filter('fluentform/validate_input_item_email', function ($error, $field, $formData) { | |
| if ($error || !defined('FLUENT_CRM')) { | |
| return $error; // already an error or FLUENTCRM is not activated | |
| } | |
| $inputName = \FluentForm\Framework\Helpers\ArrayHelper::get($field, 'raw.attributes.name'); | |
| $inputEmail = \FluentForm\Framework\Helpers\ArrayHelper::get($formData, $inputName); | |
| $crmContact = FluentCrmApi('contacts')->getContact($inputEmail); | |
| $blockListTagIds = [1, 2]; // change the tags IDs | |
| if ($crmContact && $crmContact->hasAnyTagId($blockListTagIds)) { | |
| $error = [ | |
| 'email_blocked' => __('The email address you have entered is blocked from submitting this form.', 'fluentform') | |
| ]; | |
| } | |
| return $error; | |
| }, 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment