enable_captcha
Filter the captcha setting so it can be controlled programatically.
You need to have a working knowledge of Hooks before you get started.
Parameters
Name | Type | Description |
---|---|---|
$enabled |
parameter |
(boolean) |
$auth |
parameter |
(JReviews\Services\Authentication::class) authentication instance |
Boilerplate Code
Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.
Clickfwd\Hook\Filter::add('enable_captcha', function($enabled, $auth)
{
// Uncomment line below to view available data passed into hook
// fwd_dd($enabled, $auth);
return $enabled;
});
Examples
Disable captcha for specific user IDs
When captcha is enabled for registered users, it applies to all users. The example below allows disabling the recaptcha for specific user IDs.
Clickfwd\Hook\Filter::add('enable_captcha', function($enabled, $auth) {
$trustedUserIds = [1,2,3];
if (in_array($auth->id, $trustedUserIds)) {
return false;
}
return $enabled;
});
Source Files
/services/authentication/authentication.php