Fix captcha validation on multi-page forms
This commit is contained in:
@@ -12,11 +12,12 @@ namespace Ogre\Captcha\GravityForms;
|
||||
|
||||
use Ogre\Singleton;
|
||||
use Ogre\Captcha as Plugin;
|
||||
use GFForms;
|
||||
use GFAddOn;
|
||||
use Ogre\Captcha\API;
|
||||
use Ogre\Captcha\Settings;
|
||||
use Ogre\Captcha\Widget;
|
||||
use GFForms;
|
||||
use GFAddOn;
|
||||
use GFFormDisplay;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
@@ -132,7 +133,9 @@ final class Addon extends GFAddOn {
|
||||
public function validation(array $validation_result, string $context): array {
|
||||
if ($context != 'form-submit') return $validation_result;
|
||||
|
||||
if (!Settings::is_connected() || !$this->is_enabled(rgar($validation_result, 'form'))) return $validation_result;
|
||||
$form = $validation_result['form'];
|
||||
if (!GFFormDisplay::is_last_page($form) || rgpost('action') == 'heartbeat') return $validation_result;
|
||||
if (!Settings::is_connected() || !$this->is_enabled($form)) return $validation_result;
|
||||
|
||||
$errors = API::process(Widget::get_token());
|
||||
if ($errors->has_errors()) {
|
||||
|
||||
Reference in New Issue
Block a user