Index: captcha/captcha.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/captcha/captcha.module,v
retrieving revision 1.57
diff -u -r1.57 captcha.module
--- captcha/captcha.module	7 Jan 2008 13:34:53 -0000	1.57
+++ captcha/captcha.module	7 Jan 2008 20:11:12 -0000
@@ -195,10 +195,9 @@
       return;
     }
 
-    // Add a CAPTCHA part to the form (depends on value of captcha_description)
     $captcha_description = _captcha_get_description();
     if ($captcha_description) {
-      // $captcha_description is not empty: CAPTCHA part is a fieldset with description
+      // If $captcha_description is set: wrap CAPTCHA form items in a fieldset.
       $form['captcha'] = array(
         '#type' => 'fieldset',
         '#title' => t('CAPTCHA'),
@@ -207,7 +206,7 @@
       );
     }
     else {
-      // $captcha_description is empty: CAPTCHA part is an empty markup form element
+      // Otherwise wrap CAPTCHA form items in an simple div.
       $form['captcha'] = array(
         '#type' => 'markup',
         '#prefix' => '<div class="captcha">',
@@ -251,13 +250,14 @@
       ),
     );
 
-    // handle the pre_render functions
-    $form['captcha']['#pre_render'] = array('captcha_pre_render', 'captcha_pre_render_place_captcha');
-
-    // Add a validation function for the CAPTCHA part of the form
+    // Add pre_render and validation function to the CAPTCHA section of the form.
+    $form['captcha']['#pre_render'] = array('captcha_pre_render');
     $form['captcha']['#element_validate'] =  array('captcha_validate');
 
+    // Add pre_render function handling CAPTCHA placement to the whole form.
+    $form['#pre_render'][] = 'captcha_pre_render_place_captcha';
   }
+
   elseif (user_access('administer CAPTCHA settings') && variable_get('captcha_administration_mode', FALSE) && arg(0) != 'admin') {
     // For administrators: show CAPTCHA info and offer link to configure it
     $result = db_query("SELECT module, type FROM {captcha_points} WHERE form_id = '%s'", $form_id);
@@ -291,8 +291,8 @@
         '#value' => l(t('Place a CAPTCHA here for untrusted users.'), "admin/user/captcha/$form_id/enable", array('query' => drupal_get_destination()))
       );
     }
-    // Add pre_render function for placing the CAPTCHA just above the submit button
-    $form['captcha']['#pre_render'] = array('captcha_pre_render_place_captcha');
+    // Add pre_render function handling CAPTCHA placement to the whole form.
+    $form['#pre_render'][] = 'captcha_pre_render_place_captcha';
   }
 }
 
