How to Add reCaptcha to Custom Forms in Orchard CMS

How to Add reCaptcha to Custom Forms in Orchard CMS

In Orchard 1.5 there are a number of new anti-spam features, like reCaptcha, spam filters, and submission limiters to protect your custom forms from spam. Here is a quick Orchard CMS Tutorial that teaches Orchard Web Developers how to add reCaptcha to custom forms.

Orchard CMS Anti-Spam Features

In order to use the new anti-spam features in Orchard you will need to be running Orchard 1.5 and download the new AntiSpam Module from the Orchard Gallery. Just do a search for "antispam" in the gallery and you will find one versioned as 1.5.

Anti-Spam Module in Orchard CMS

Once you download and install the AntiSpam Module you will need to enable the AntiSpam Feature. As I mentioned eariler, Orchard has 3 anti-spam features at this point: reCaptcha, Spam Filtering, and Submission Limiter. All of these features are enabled when you enable the Anti-Spam Feature. ( Note: for Spam Filtering you will also need to enable a provider, like Akismet or TypePad, but that is not necessary for using just reCaptcha. )

Anti-Spam Feature in Orchard CMS

Add reCaptcha Part to your Custom Form Content Type

Essentially what you have done at this point is enabled a ReCaptcha Content Part that can be attached to content types. You now have to attach this content part to your custom form content type. Edit your custom form content type and add the ReCaptcha Part.

Add reCaptcha Part to Custom Form in Orchard CMS

When you add the part you will be asked to provide the public and private keys for the reCaptcha service. If you haven't signed up for reCaptcha, you can follow the link provided in the settings. You must provide the public and private reCaptcha keys for the API or it will not work.

reCaptcha Settings in Orchard CMS

Save the content type once you have added the reCaptcha keys.

Custom Orchard Form with ReCaptcha

Now that you have added the reCaptcha Part to your custom form in Orchard CMS you will see the reCaptcha being displayed on your custom form. This is perfect for contact forms on your Orchard Website.

Orchard CMS Contact Form with reCaptcha

Conclusion

The new anti-spam features introduced in Orchard 1.5 are easy to use with custom contact forms on your Orchard Websites. You can use reCaptcha, spam filtering, and submission limiters to avoid receiving spam in your Orchard Websites.

I am available for hire if you need help implementing these features on your Orchard Website.