I've set up the standard recaptcha plugin in Joomla. I did an override of the login page and it wasn't showing the recaptcha, so I tried to add it by following the answer from these pages:

My Captcha stopped working after upgrading to Joomla 3.5


The problem is that the recaptcha shows up fine, but I'm able to login without using the captcha check button / image clicking... I have figured out a way to check it before sending with jquery, but the big hurtle is that I don't understand why it is going through on the server side? should'n Joomla handle that as it's a build in plugin?

Here's the code I've put inside the <form tag> (copy paste from the first link):

$captcha_plugin = JFactory::getConfig()->get('captcha');
if ($captcha_plugin != '0') {
  $captcha = JCaptcha::getInstance($captcha_plugin);
  $field_id = 'your_old_and_useless_id';
  print $captcha->display($field_id, $field_id, 'g-recaptcha');

And I don't know what this defines? $field_id = 'your_old_and_useless_id'; I've tried to look it up, but I can't really find any documentation on how to inplement the Joomla standard recaptcha.

I really apriciate your help! thanks!!

  • Does your captcha work on the core login without the override? I just want to strip back a bit to check for functionality (divide and conquer). Are you saying that you are delivering the form submission via jquery or html form submit? Can you also tell us about the versions of everything that you are using? (I'm not personally going to have a solution for you, just trying to add more details for other users.) Oct 17, 2018 at 22:45
  • Joomla does not validate recaptcha for login by default. You need to add that logic and the possible ways have already been added by @Sharky. You should try one of them.
    – Irfan
    Oct 19, 2018 at 6:40

2 Answers 2


I cannot see how the accepted answer answers the question. So, since you are quoting from my answer on the other question, I will explain what I meant.

The JCaptcha::display() function accepts three arguments: Name, ID and Class. Since Joomla 3.5, the first two arguments were rendered useless. That's why I wrote your_old_and_useless_id as the $field_id. Since it has been more than 2 years since I last checked this Joomla code, I cannot be sure that it is still useless!

Now, your question seems to ask if the captcha is automatically validated. It is not. You need to validate it amongst your other fields to validate. Here is the code I have used:

if (JFactory::getConfig()->get('captcha') != '0') {
    $captcha = JCaptcha::getInstance(JFactory::getConfig()->get('captcha'));
    $isValidated = $captcha->checkAnswer('your_old_and_useless_id');
  • You are right! I think I was a little fast and got things mixed up. I’m glad you took your time to help me with this. I’ll test you answer as soon as I can! Oct 18, 2018 at 17:39
  • @mickmackusa No, but I will now... Oct 19, 2018 at 11:43

This won't work. View does not and cannot handle data validation. It's a task for controller/model. Login forms in Joomla! do not support plugins at the moment. There are several ways to achieve what you want:

1) Create a custom component for login functionality and a plugin to redirect com_users traffic to this component.

2) Create a plugin that alters the login form and performs custom validation on login task.

3) Use MVCOverride plugin to override com_users login controller/model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.