--- C:/Documents and Settings/jimmy/®à­±/captcha.module Tue Jun 19 09:00:22 2007 +++ C:/Documents and Settings/jimmy/®à­±/captcha_new.module Sat Jun 23 16:46:56 2007 @@ -1,5 +1,5 @@ array()); + if(is_array($form['#validate'])){ + $form['#validate'] = array_merge($form['#validate'], $validate_ary); + } + else{ + $form['#validate'] = $validate_ary; - if(!isset($form['#validate'])) - $form['#validate'] = array(); - $form['#validate'] += array('captcha_validate' => array()); + } $form['#pre_render'] = array('captcha_prerender'); $_SESSION['captcha'][$seed]['success'] = FALSE; @@ -206,6 +210,7 @@ $_SESSION['captcha'][$seed]['preprocess'] = isset($result['preprocess'])? $result['preprocess'] : FALSE; $_SESSION['captcha'][$seed]['module'] = $challenge[0]; $_SESSION['captcha'][$seed]['type'] = $challenge[1]; + $_SESSION['captcha'][$seed]['value'] = $_SESSION['captcha'][$seed]['value'] ? $_SESSION['captcha'][$seed]['value'] : $result['value']; } function captcha_validate($form_id, $form_item) { @@ -262,7 +267,7 @@ '#type' => 'textfield', '#title' => t('Math Question: What is %problem?', array('%problem' => $x .' + '. $y)), '#description' => t('Please solve the math problem above and type in the result. e.g. for 1+1, type 2.'), - '#weight' => 0, + '#weight' => 5, '#required' => TRUE, ); }