How to implement a Contact Us form in WordPress? This article describes how to add a very simple Contact from using WordPress 3.0.1 and two plug-in(s):
– Contact Form 7 and
– Really Simple CAPTCHA.
Later, you can customize the contact form to your delight using HTML tags through provided user interface. Very flexible solution and as far as I can see – it is a bug free solution.
As you can see on the picture, this solution has a support for CAPTCHA image code. CAPTCHA is an image with numbers and letters that appears above Submit button. User is required to enter these numbers and letters into a text filed to ensure human presence and block the robots from sending automatic spam messages.
If directory wpcf7_captcha is not created under your upload directory, you might need to give Write rights to your anonymous Internet user. I’ve noticed that on Windows 7 and IIS 7.5 you need to add user IUSR to be able read and write to that directory (not the group IIS_IUSRS) For some reason user IUSR is NOT a member of group IIS_IUSRS.
CAPTCHA requires something called GD and FreeType Support. Luckily, PHP Version 5.2.14 for Windows (http://php.iis.net/) comes with GD Support and FreeType Support. You do not need to do anything additional – they are installed and configured for you to use. You can use your info.php to verify:
Out of the box contact form template doesn’t include CAPTCHA code on the form. To add a CAPTCHA code and field, add this tag to your Contact Form 7 template:
[captchac your-captcha] <label>Enter the code - Наберите Код <br /> Case-insensitive - Используйте прописные буквы <br /> [captchar your-captcha]</label>
You might notice a small problem with this solution. After sending the message, user still faces the same empty contact form. There is a simple trick that doesn’t require changing the code.
I used template Message area to redirect to a previous page, if the message was sent successfully:
This code (above) was tested and works on Windows based (IIS) server.
Here is a link, where I picked up this super-great idea to insert a script into a success message box:
Next things to work on for this form are :
– How to pass parameters into the form to pre-populate Email To and Subject?
– How to limit the legth of input fields?
– Remove words “Comments are closed.” at the bottom of the page