Hi

I have been able to create a Captcha on the newsletter subscription page for an authenticated user newsletter but the Captcha will not appear on the newsletter subscription page for an anonymous user newsletter.

The form id being used by Captcha is mailchimp_subscribe_form

Is there anyway to make the Captcha visible for anonymous users?

Thanks for any assistance you can give.

Comments

levelos’s picture

Status: Active » Fixed

The form_id actually changed in the last request, mailchimp_anon_subscribe_form and mailchimp_auth_subscribe_form

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

benakiva’s picture

Version: 6.x-2.0-rc2 » 6.x-2.0-rc4
Priority: Normal » Critical
Status: Closed (fixed) » Needs work

I registered these two form_id mailchimp_anon_subscribe_form and mailchimp_auth_subscribe_form in captcha admin page, but the captcha does not appear in the subscription form, neither for authenticated user nor for anonymous user. Is there a regression in version rc4?

steveray’s picture

Try: mailchimp_subscribe_anon_form and mailchimp_subscribe_auth_form
Note the "anon" and "auth" moved to the right of "mailchimp_subscribe_".

Also, make sure that the roles you are testing with do not have the Skip Captcha box checked in the Captcha permissions section.

Steve
PS: I'm using Mailchimp 6.x-2.0-rc4 and Captcha 6.x-2.1

levelos’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tanzeel’s picture

Mailchimp - 6.x-2.5
Captcha - 6.x-2.4

Captcha doesn't work properly with mailchimp subscription form. As per my findings Captcha module doesn't get form values in a way mailchimp posts. To get captcha properly work with mailchimp subscription form in captcha module file in captcha_validate() function you have to modify the code to get captcha_response from posted data in right way which is not handled by captcha module yet. Find the line $form_state['values']['captcha_response'] somewhere in start of function and replace with

if(isset ($form_state['values']['captcha_response'])){ // edited by tanzeel
    $captcha_response = $form_state['values']['captcha_response'];
  } else {
    $captcha_response = $form_state['values']['captcha']['captcha_widgets']['captcha_response'];
  }

to get $captcha_response variable set in case of mailchimp subscription form.

Also need to modify same kinda lines in _captcha_get_posted_captcha_info() function.

Find

if (isset($element['#post']) && count($element['#post'])) {
      $post_data = $element['#post'];
    }

and replace with

if (isset($element['#post']) && count($element['#post'])) {
      if(isset($element['#post']['captcha_sid'])){ // added by tanzeel
        $post_data = $element['#post'];
      } else {
        $post_data = $element['#post']['captcha'];
        $post_data['form_id'] = $element['#post']['form_id'];
      }
    }

to work captcha properly with mailchimp subscription form.

Hope this helps.