Merge pull request #18033 from eileenmcnaughton/cont_id
[civicrm-core.git] / CRM / Mailing / Form / Subscribe.php
index 1be92c12145af51379b8ca4348d67368ebb201d7..97405dce40716e93f8d11136826a457e92aff25c 100644 (file)
@@ -105,32 +105,11 @@ ORDER BY title";
       $this->addFormRule(['CRM_Mailing_Form_Subscribe', 'formRule']);
     }
 
-    $addCaptcha = TRUE;
-
-    // if recaptcha is not configured, then dont add it
-    // CRM-11316 Only enable ReCAPTCHA for anonymous visitors
-    $config = CRM_Core_Config::singleton();
+    // CRM-11316 Enable ReCAPTCHA for anonymous visitors
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
 
-    if (empty($config->recaptchaPublicKey) ||
-      empty($config->recaptchaPrivateKey) ||
-      $contactID
-    ) {
-      $addCaptcha = FALSE;
-    }
-    else {
-      // If this is POST request and came from a block,
-      // lets add recaptcha only if already present.
-      // Gross hack for now.
-      if (!empty($_POST) &&
-        !array_key_exists('recaptcha_challenge_field', $_POST)
-      ) {
-        $addCaptcha = FALSE;
-      }
-    }
-
-    if ($addCaptcha) {
+    if (!$contactID) {
       CRM_Utils_ReCAPTCHA::enableCaptchaOnForm($this);
     }