Validate answer via regex patch
-
thanks for the useful plugin. When the answer is checked I’d suggest using a regex instead of equals as it’s much more flexible. Having to type Paris or pARIS or pArIs or PARIS or paris or parIS or …, well, you get the idea… Here’s a small patch which should fix that for you.
diff --git a/wp-content/plugins/no-bot-registration/no-bot-registration.php b/wp-content/plugins/no-bot-registration/no-bot-registration.php index c634b133..34a798ae 100644 --- a/wp-content/plugins/no-bot-registration/no-bot-registration.php +++ b/wp-content/plugins/no-bot-registration/no-bot-registration.php @@ -223,6 +223,7 @@ function ajdg_nobot_filter($user_login, $user_email = '', $errors = '') { if($question_id < count($answers_all)) { $answers = $answers_all[$question_id]; foreach($answers as $answer) { + if( preg_match( "/^$answer$/i", trim($_POST['ajdg_nobot_answer']) ) ) return $user_login; if(trim($_POST['ajdg_nobot_answer']) == $answer) return $user_login; } } @@ -540,4 +541,4 @@ function ajdg_nobot_notifications_dashboard() { echo '</div>'; } } -?> \ No newline at end of file +?>
- The topic ‘Validate answer via regex patch’ is closed to new replies.