*** oldriddler/riddler/riddler.module 2008-03-28 04:41:48.000000000 -0700 --- riddler/riddler.module 2010-08-26 15:48:35.000000000 -0700 *************** *** 52,68 **** function riddler_settings() { $form['riddler_question'] = array( ! '#type' => 'textfield', '#title' => t('Question'), ! '#description' => t('A question that you require anonymous users to answer'), '#default_value' => variable_get("riddler_question", "Do you hate spam? (yes or no)"), '#required' => TRUE, ); $form['riddler_answer'] = array( ! '#type' => 'textfield', '#title' => t('Answer'), '#default_value' => variable_get("riddler_answer", "yes"), ! '#description' => t('Answer to the above question. Answers are not case sensitive'), '#required' => TRUE, ); $form['riddler_weight'] = array( --- 52,68 ---- function riddler_settings() { $form['riddler_question'] = array( ! '#type' => 'textarea', '#title' => t('Question'), ! '#description' => t('questions, one per line, that you require anonymous users to answer one of'), '#default_value' => variable_get("riddler_question", "Do you hate spam? (yes or no)"), '#required' => TRUE, ); $form['riddler_answer'] = array( ! '#type' => 'textarea', '#title' => t('Answer'), '#default_value' => variable_get("riddler_answer", "yes"), ! '#description' => t('Answers to the above questions, one per line. Answers are not case sensitive'), '#required' => TRUE, ); $form['riddler_weight'] = array( *************** *** 108,119 **** } } function riddler_form () { $form['preprocess'] = TRUE; ! $form['solution'] = (string)(strtolower(variable_get("riddler_answer", "yes"))); $form['form']['captcha_response'] = array( '#type' => 'textfield', ! '#title' => variable_get("riddler_question", "Do you hate spam? (yes or no)"), '#required' => TRUE, '#description' => t('Security question, designed to stop automated spam bots'), '#weight' => variable_get('riddler_weight', 0), --- 108,127 ---- } } + // we've hacked the module so now the question and answer variables are lists of possible options + // let's pick one randomly. + function riddler_form () { + + $questions = explode("\n", variable_get("riddler_question", 'no questions have been set')); + $answers = explode("\n", variable_get("riddler_answer", 'no answers have been set')); + $choice = array_rand($questions); $form['preprocess'] = TRUE; ! $form['solution'] = (string)(chop(strtolower($answers[$choice]))); $form['form']['captcha_response'] = array( '#type' => 'textfield', ! // '#title' => variable_get("riddler_question", "Do you hate spam? (yes or no)"), ! '#title' => $questions[$choice], '#required' => TRUE, '#description' => t('Security question, designed to stop automated spam bots'), '#weight' => variable_get('riddler_weight', 0),