Using ReCaptcha in your component
If you are using JForm on the frontend, then implementing a CAPTCHA plugin is very easy; you just need to add a field to your XML file, then add a couple of language strings. Edit the folio.xml
file under /components/com_folio/models/forms/
and add the following field after description
:
<field name="captcha" type="captcha" label="COM_FOLIO_CAPTCHA_LABEL" description="COM_FOLIO_CAPTCHA_DESC" validate="captcha" namespace="contact" />
Now, add the following language strings in /components/com_folio/language/en-GB/en-GB.com_folio.ini
:
COM_FOLIO_CAPTCHA_LABEL="Enter code" COM_FOLIO_CAPTCHA_DESC="This is to verify that you are a human"
Joomla! can use a variety of CAPTCHA plugins, but ReCaptcha is built-in; that is why we are using it in this book. For ReCaptcha to work, you must enable the Captcha – ReCaptcha plugin, and enter your Public Key and Private Key that you get when you sign up at http://www.google.com/recaptcha:
You should also set...