Added support for generic implementation (very simple)#168
Added support for generic implementation (very simple)#168LU-386 wants to merge 7 commits intoFriendlyCaptcha:mainfrom
Conversation
|
Thanks for the PR! I think this is a great idea :) I wonder if we even need to register this as an integration in |
|
|
||
| public static $integrations = array( | ||
| array( | ||
| public static $integrations = [ |
There was a problem hiding this comment.
These appear to be mostly formatting changes. Could you remove them so we can only merge the actual changes?
| return false; | ||
| } | ||
|
|
||
| $verification = frcaptcha_verify_captcha_solution( |
There was a problem hiding this comment.
I guess other plugins could also just call frcaptcha_verify_captcha_solution directly right? I'm not a Wordpress expert so I wonder what the benefit of the additional filter is 🤔
There was a problem hiding this comment.
The filter name(s) must correspond to the filter name(s) in the FC module file. So in theory, it should be possible to have a generic module with filter names that the actual WP forms use.
However, I remember that I first tried to use the html-forms module for my purposes but it didn't work (may be I did a mistake).
Second:
All supported form plugins are listed in the core.php file like this:
array(
"name" => "HTML Forms",
"slug" => 'html_forms',
"entry" => "html-forms/html-forms.php",
"plugins" => array("html-forms/html-forms.php"),
"settings_description" => "Enable Friendly Captcha for <a href=\"https://wordpress.org/plugins/html-forms/\" target=\"_blank\">HTML Forms</a>.",
),
That means there are hardcoded plugin names and paths, anyway (entry, plugins). So it makes no difference if we have custom filter names or not (I guess) since every single form plugin that we want to support needs it's own module file.
There was a problem hiding this comment.
I really wanted to keep it simple and version agnostic to implement.
If there is something additional to be handled in the future, it can just be added into the filter without affecting anything else by changing frcaptcha_verify_captcha_solution.
…on.php Co-authored-by: Merlin <merlinfuchs2001@gmail.com>
…on.php Co-authored-by: Merlin <merlinfuchs2001@gmail.com>
Hey,
i was looking for documentation to integrate FriendlyCaptcha into a custom plugin and found basically nothing.
My unknown friend Steve was looking for something like this as well.
I grabbed most of the code from #167 for simplicity. Thanks to @RealZendor for the great base.
Implementation would be made in two simple steps after enabling the option in the settings.
Use the filter 'fch_captcha_append_widget' on your form or an empty string and print it:
Use the filter 'fch_captcha_validation' before handling your inputs and get a bool (true = human, false = bot / missing solution):
Let me know if you are looking to merge this or not.
Thanks for the great software btw!