Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Q2A Core by
Please advise how to add recaptcha on login page, there has been spamming on my site and lots of users are trying to spam.
Q2A version: 1.7

1 Answer

0 votes
edited by

I think you'll have to patch the login page for that (qa-include/pages/login.php). Check one of the other pages that already have a captcha as an example (e.g. qa-include/pages/feedback.php).

You'll probably need at least something like this:

require_once QA_INCLUDE_DIR . 'app/captcha.php';
$usecaptcha = qa_user_use_captcha();
if ($usecaptcha)
if ($usecaptcha && !qa_is_logged_in())
  qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors);

Untested, so take it with a grain of salt.

Beware, though, that changes to core files will be lost when you update Q2A, so you'll have to re-apply your changes after an update.

Also, are you using anything besides reCAPTCHA so far? There are several anti-spam plugins available, and there's also Amiya Sahu's Registration Blocker plugin, which I forked recently to add some more features.