Just in case someone also want to use Google reCAPTCHA in their 'Ask a Question' plugin,
below is how I made it works:
There are 3 files that need to be amended:
File 1: includes/classes/observers/class.google_recaptcha.php
Add this around line 24:
PHP Code:
$pages_to_check[] = 'NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK';
Change this
PHP Code:
$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text');
to this:
PHP Code:
$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text', 'NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK' => 'contact');
File 2: includes/functions/extra_functions/recaptchalib.php
Change this (around line 70)
PHP Code:
$event_array = array('contact_us' => 'contact', 'create_account' => 'create_account', 'reviews_write' => 'review_text');
to this:
PHP Code:
$event_array = array('contact_us' => 'contact', 'create_account' => 'create_account', 'reviews_write' => 'review_text', 'ask_a_question' => 'contact');
File 3: includes/templates/YOUR_TEMPLATE/templates/tpl_ask_a_question_default.php
Add this before </fieldset>:
PHP Code:
<?php echo recaptcha_get_html(false); ?>
The attached image shows how reCAPTCHA works in the Ask A Question plugin
P.S. I'm using the latest version of both plugins:
- Google reCAPTCHA CAPTCHA - Version: 3.4
- Ask A Question - Version:2.2
Good Luck!
Bookmarks