The choosen reCAPTCHA look should depend on what Drupal theme is currently being used.

For example, if you have a red Garland theme, the reCAPTCHA red theme is good. But, if you then change the theme to a clear white Minelli theme, you'd want the reCAPTCHA theme to change white without having to go into the reCAPTCHA settings. How would we accomplish this?

Comments

robloach’s picture

We might be able to have a fieldset pop up for all the current Drupal themes allowing the user to choose which reCAPTCHA theme to display for each one.

kthagen’s picture

What about hooking in to the theme settings the way that the themesettingsapi module does. That way, the recaptcha theme can be changed when setting up each theme, and you're not limited to stock themes.

robloach’s picture

Very cool idea... We could check if the Theme Settings API module is available, and use it if it is to provide per-theme reCAPTCHA looks.

robloach’s picture

It would be something like this:

/**
 * reCAPTCHA implementation of hook_form_alter
 */
function recaptcha_form_alter($form_id, &$form) {
  switch ($form_id) {
    case 'system_theme_settings': 
      // Per theme reCAPTCHA settings
      $form['recaptcha_theme_settings'] = array(
        '#type' => 'fieldset',
        '#title' => t('reCAPTCHA Theme Settings'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['recaptcha_theme_settings']['recaptcha_theme_'. arg(4)] = array(
        '#type' => 'select',
        '#title' => t('Theme'),
        '#description' => t('Defines which theme to use for reCAPTCHA.'),
        '#options' => array(
          'red' => t('Red'),
          'white' => t('White'),
          'blackglass' => t('Black Glass'),
        ),
        '#default_value' => variable_get('recaptcha_theme_'. arg(4), 'red'),
        '#required' => TRUE,
      );
      // Move submit buttons to bottom
      $form['buttons']['#weight'] = 1;
      break;
  }
}
liam morland’s picture

Status: Active » Closed (won't fix)

Versions prior to Drupal 6 are no longer supported. If this issue still exists in a supported version, please re-open and provide details.