You are here

function _captcha_persistence_skip in CAPTCHA 6

Same name and namespace in other branches
  1. 5.3 captcha.module \_captcha_persistence_skip()

Helper function for checking if the CAPTCHA for the given form_id should be skipped because of CAPTCHA persistence.

2 calls to _captcha_persistence_skip()
captcha_form_alter in ./captcha.module
Implementation of hook_form_alter().
captcha_pre_render in ./captcha.module
Implementation of form #pre_render.

File

./captcha.module, line 163
This module enables basic CAPTCHA functionality: administrators can add a CAPTCHA to desired forms that users without the 'skip CAPTCHA' permission (typically anonymous visitors) have to solve.

Code

function _captcha_persistence_skip($form_id) {
  switch (variable_get('captcha_persistence', CAPTCHA_PERSISTENCE_SHOW_ALWAYS)) {
    case CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL:
      return isset($_SESSION['captcha']['success']) && $_SESSION['captcha']['success'] === TRUE;
    case CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM:
      return isset($_SESSION['captcha'][$form_id]['success']) && $_SESSION['captcha'][$form_id]['success'] === TRUE;
    default:
      return FALSE;
  }
}