Drupal 7 reCAPTCHA module

By adam
Fri, 2014-05-02 08:27
Daily Dose of Drupal Episode #146

Share with Others

In this Daily Dose of Drupal video we feature the Drupal 7 reCAPTCHA module.

In this episode you will learn:

  • How to register a domain with Google's reCAPTCHA service
  • How to set up the the reCAPTCHA module
  • How to set where you would like the reCAPTCHA form to appear on the site

Hey everybody and welcome to Episode Number 146 of the Daily Dose of Drupal with Code Karate. I’m Adam and today we’re going to covering the reCaptcha Module. The reCaptcha Module is an add-on module by Google to enhance the Captcha Module, hints the name reCaptcha.

Before we get started though as always you can follow myself on Twitter at Adam Learing, you can also follow Shane at smthomas3 and also make sure to head over to codekarate.com, there you can sign up for our newsletter, get our latest post on as well any tips and tricks we stumble across over the past month but don’t worry we don’t burden your e-mail with a ton of sends, just view of here and there, I’ll let you know of what’s going on and staying up to date.

Alright back to the reCaptcha Module, so in drupal.org you can download the reCaptcha Module, it has a version over Drupal 7 and Drupal 6. We’re going to be obviously be using Drupal 7, I highly recommend moving everything to Drupal 7 just because of the support and Drupal 8 be coming out.

ReCaptcha module does depend on the Captcha Module and also you want to make sure you’re using an updated version of JQuerry, you don’t technically need this module if you are using an updated version but if you’re not, this module will get you up to date. So to get started we download these two modules and then we just need to enable them on our site.

So we head on over to our module’s page and from there we can enable them. We’re only going to use the caption of the reCaptcha Module, there is two other ones in here on the image captcha which I would show an image on the captcha but we’re actually using that module and then the Mail Hide reCaptcha, which is kind of a fancy way to help protect some e-mail addresses but we won’t be covering those today.

So let’s enable those two modules, once they’re enabled you can go under Configuration and then configure the module. So you want a captcha and then there you’ll see there’s couple different tabs on the top, there was a captcha and then the reCaptcha Module. Again we’re using the reCaptcha Module being that it’s an add-on to the Captcha Module but we’ll still use some settings within the captcha.

The biggest start is go over to reCaptcha and in here there’s two important fields; there’s a Public and a Private Key. And as I said earlier, reCaptcha’s are supported by Google and then I just want to make sure that you are registered before using the reCaptcha Module.

So pretty simple; so clicking on that link loads this page right here and then from there you can get the reCaptcha and then all you needed to do is sign up now and enter your domain name that you want to use it on. I’ve actually already done that so I will … you see below here I have added the domain that I’m using as well as Code Karate’s so you can just simply click on that link, grab the Public Key, paste that in and then we can grab the Private Key and paste that in.

The rest of the default settings will work for now, one thing you can notice is that there is a Theme setting down here where you can play around with different colors and things with the Captcha Module but go ahead and save that, it says everything is checked out all right then we can head back to the Captcha page here and then once that’s set up you have to tell the reCaptcha where you want them to show up and like I said; the reCaptcha works off of the Captcha Module.

So for example; the Comment Node forms … so basically these are the comment forms for our different content types so we want the reCapthca model will show up on those. Like I said; you can also use the captcha module if you want so like on the user registration form if you wanted to use the defaults, the captcha module challenge, you can do that or the Math Captcha, you could do that as well. Because this video we’re focusing just on the reCaptcha Module so we’re just going to test it out on the captcha on the comment forms for those three content types.

A bunch of other settings you can kind of play around with, nothing really important being that we are using the reCaptcha Module here and not the default captcha so it kinds of overrides all of these stuff anyway. So let’s go ahead and save the configuration and then all you need to do to test it is log out of your site, typically those kind of depends on your permissions whether comments are allowed or not but if you log out of your site here and then you go to a node page, at the bottom of the node page on the comment form you’ll see right here as the Captcha and this is using the reCaptcha Module.

So this is again is supported by Google but this would be to keep out spam and all the robots that are trying to post, not want a comments. So anyway we can enter this in, this one … the reCaptcha Module is actually a little bit better than the plain captcha module because it does a little bit more of the algorithmic learning than the other modules do so it kind of helps learn a little bit more and not directly do one size fits all for all people.

So you can enter and then we go ahead and save it. And then it says it went through, we have a core sight currently said not to allow comments to go through without approval but it still let us post a comment itself without going in there.

So anyway; that is the reCaptcha Module, again you can just head over to drupal.org and download that and make sure to download the Captcha Module as well and, you know, have fun limiting all the spam box on your site. Again you can follow me at Adam Learing on Twitter, I’d appreciate that as well as head over to the codekarate.com site, sign up for the newsletter, stay informed and happy coding, back to you guys later.