'fieldset', '#title' => t('Anti-spam Question'), '#weight' => 1, '#collapsible' => FALSE ); $form['antispamquestion']['antispamquestion_answer'] = array( '#type' => 'textfield', '#title' => t(variable_get('antispamquestion_question', ANTISPAM_DEFAULT_QUESTION)), '#default_value' => $edit['antispamquestion_answer'], '#description' => t('This question is here to help deter spam bots from creating user accounts.'), '#maxlength' => 64, '#required' => TRUE ); return $form; break; case 'validate': // only do this check for new accounts if ($category == 'account' && !$user->uid ) { if (strtolower($edit['antispamquestion_answer']) != strtolower(variable_get('antispamquestion_answer', ANTISPAM_DEFAULT_ANSWER))) { watchdog('antispamquestion', t('Someone attempted to register as %name from %mail and incorrectly answered the anti-spam question with \'%answer\'.', array('%name' => $edit['name'], '%mail' => $edit['mail'], '%answer' => $edit['antispamquestion_answer']))); form_set_error('antispamquestion_answer', t('You did not answer the question correctly. Please try again.')); } } break; } } /** * Implementation of hook_settings(). */ function antispamquestion_settings() { $form['antispamquestion_question'] = array( '#type' => 'textfield', '#title' => t('Anti-spam Question'), '#size' => 30, '#maxlength' => 255, '#default_value' => variable_get('antispamquestion_question', ANTISPAM_DEFAULT_QUESTION), '#description' => t('This is the question that users must answer to register.'), ); $form['antispamquestion_answer'] = array( '#type' => 'textfield', '#title' => t('Anti-spam Answer'), '#size' => 30, '#maxlength' => 64, '#default_value' => variable_get('antispamquestion_answer', ANTISPAM_DEFAULT_ANSWER), '#description' => t('This is the answer to the Anti-spam question.'), ); return $form; }