CodeIgniter Forums

Full Version: Help with captcha
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
I have a comments module and I want to add captcha to the comment form. I've seen a lot of examples but cant seem to get how to do it...

Could I pls get help with the correct codes to add to the comments_view, comments_model and comments_controller file to get the captcha to work. A solution will b well appreciated.

El Forum

[eluser]Unknown[/eluser]
If you download the recaptcha here: https://developers.google.com/recaptcha/docs/php

You can add the recaptcha library as a helper. Rename it to recaptchalib_helper.php and put it in your helper folder.

Edit the recaptcha function with the pub key (which you need to request here - https://www.google.com/recaptcha/admin/create):

Code:
function recaptcha_get_html ($pubkey = '{put your key in here}', $error = null, $use_ssl = false)

From there you just need to add:
Code:
echo recaptcha_get_html();

where you want the captcha displayed.

EX:
Code:
//javascriptopen
  var RecaptchaOptions = {
   theme : 'clean'
  };
  //javascript end
        <label class="ipsField_title" for="display_name">
            Security
        </label>
        <p class="ipsField_content">
            &lt;?php echo recaptcha_get_html(); ?&gt;
        </p>