? persistence.patch
Index: captcha.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/captcha.module,v
retrieving revision 1.42.2.27
diff -u -u -p -r1.42.2.27 captcha.module
--- captcha.module	5 Sep 2007 09:03:29 -0000	1.42.2.27
+++ captcha.module	5 Sep 2007 09:23:08 -0000
@@ -10,6 +10,9 @@
 
 define('CAPTCHA_UNSOLVED_CHALLENGES_MAX', 20);
 
+define('CAPTCHA_PERSISTENCE_ALWAYS', 1);
+define('CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL', 2);
+
 /**
  * Implementation of hook_help().
  */
@@ -231,10 +234,13 @@ function captcha_admin_settings($form_id
   }
   // field for captcha persistence
   $form['captcha_persistence'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Persistent captchas'),
-    '#description' => t('If checked, the user will always have to solve a captcha. If not checked, the captcha check for a form will be omitted during the rest of the session once the user has successfully solved a captcha for that form.'),
-    '#default_value' => variable_get('captcha_persistence', TRUE),
+    '#type' => 'radios',
+    '#title' => t('CAPTCHA persistence'),
+    '#default_value' => variable_get('captcha_persistence', CAPTCHA_PERSISTENCE_ALWAYS),
+    '#options' => array(
+      CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL => t('Omit CAPTCHA once the user has successfully answered a CAPTCHA (per form and per session).'),
+      CAPTCHA_PERSISTENCE_ALWAYS => t('Always add a CAPTCHA.'),
+    ),
   );
   // submit button
   $form['submit'] = array(
@@ -303,7 +309,7 @@ function captcha_form_alter($form_id, &$
     // Visitor does not have permission to skip the captcha challenge
 
     // Do not present captcha if not captcha-persistent and user has already solved a captcha for this form
-    if(!variable_get('captcha_persistence', TRUE) && ($_SESSION['captcha'][$form_id]['success'] === TRUE)) {
+    if (variable_get('captcha_persistence', CAPTCHA_PERSISTENCE_ALWAYS) == CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL && ($_SESSION['captcha'][$form_id]['success'] === TRUE)) {
       return;
     }
 
@@ -388,7 +394,7 @@ function captcha_form_alter($form_id, &$
     // prevent caching of the page with this captcha enabled form
     global $conf;
     $conf['cache'] = FALSE;
-    
+
   }
   elseif (user_access('administer captcha') && variable_get('captcha_administration_mode', FALSE) && arg(0) != 'admin') {
     // For administrators: show captcha info and offer link to configure it
@@ -473,7 +479,7 @@ function captcha_pre_render($form_id, &$
   // correctly answered and consequently adds a captcha challenge to the form.
   // The pre_render phase happens after the validation phase and makes it
   // possible to remove the captcha from the form after all.
-  if (!variable_get('captcha_persistence', TRUE) && ($_SESSION['captcha'][$form_id]['success'] === TRUE)) {
+  if (variable_get('captcha_persistence', CAPTCHA_PERSISTENCE_ALWAYS) == CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL && ($_SESSION['captcha'][$form_id]['success'] === TRUE)) {
     unset($form['captcha']);
     return;
   }
