diff --git a/lib/Form/Renderer.php b/lib/Form/Renderer.php index d9973a5b85..964ebbe75c 100644 --- a/lib/Form/Renderer.php +++ b/lib/Form/Renderer.php @@ -58,11 +58,14 @@ class Renderer { } } - public function renderBlocks(array $blocks = [], array $formSettings = [], bool $honeypotEnabled = true): string { + public function renderBlocks(array $blocks = [], array $formSettings = [], bool $honeypotEnabled = true, bool $captchaEnabled = true): string { // add honeypot for spambots $html = ($honeypotEnabled) ? $this->renderHoneypot() : ''; foreach ($blocks as $key => $block) { - if ($block['type'] === FormEntity::SUBMIT_BLOCK_TYPE && $this->settings->get('captcha.type') === Captcha::TYPE_RECAPTCHA) { + if ($captchaEnabled + && $block['type'] === FormEntity::SUBMIT_BLOCK_TYPE + && $this->settings->get('captcha.type') === Captcha::TYPE_RECAPTCHA + ) { $html .= $this->renderReCaptcha(); } if (in_array($block['type'], [FormEntity::COLUMN_BLOCK_TYPE, FormEntity::COLUMNS_BLOCK_TYPE])) { diff --git a/lib/Subscription/ManageSubscriptionFormRenderer.php b/lib/Subscription/ManageSubscriptionFormRenderer.php index 0f04024594..65f4ee236a 100644 --- a/lib/Subscription/ManageSubscriptionFormRenderer.php +++ b/lib/Subscription/ManageSubscriptionFormRenderer.php @@ -85,7 +85,7 @@ class ManageSubscriptionFormRenderer { 'email' => $subscriber->email, 'token' => $this->linkTokens->getToken($subscriber), 'editEmailInfo' => __('Need to change your email address? Unsubscribe here, then simply sign up again.', 'mailpoet'), - 'formHtml' => $this->formRenderer->renderBlocks($form, [], $honeypot = false), + 'formHtml' => $this->formRenderer->renderBlocks($form, [], $honeypot = false, $captcha = false), 'formState' => $formState, ];