Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create custom joomla captcha

I've been assigned to create a captcha verification for a custom component in joomla, but I'm stuck at how to do it properly.
I'm aware of the fact that there are many captcha plugins like recaptcha available but I am required to use a custom captcha created by the company.
It saves the image text in a session and creates the image in a component so calling index.php?option=com_captcha directly in the browser will output a captcha image.

The problem is that I'm completely new to joomla and can't seem to find a proper way to create code that could be reused through out the system. I tried to do this by creating a module that would call the captcha component, then do the logic and check if captcha was correct.
The problem I faced with doing this was the fact that I couldn't find a way to pass variables to my module, thus I couldn't pass the session variable that's required by captcha component.

I've looked at plugins but I'm not sure that you can call a plugin directly from a component.

I'm currently stumped and got no ideas which direction to go to and what to search for. Any help will be appreciated, thanks.

like image 853
Eliah John Avatar asked Apr 14 '26 15:04

Eliah John


1 Answers

You don't mention your Joomla! version but if it's 1.6+ why not use a captcha plugin?

Then any third party extension can use it automatically if you set it as the sites default captcha mechanism.

Plugins are also a lot easier to write than a component... captcha plugins only have a few required methods — onInit($id), onDisplay($name, $id, $class) and onCheckAnswer($code)

like image 173
Craig Avatar answered Apr 17 '26 04:04

Craig