Digital Access Pass, as with any membership site that has a sign-up form, will be subject to SPAM.
If you’re not doing anything to prevent SPAMmers and bots, you’re likely going to get overwhelmed quickly.
My solution was to adopt, and extend upon, the elegance of the Growmap Anti Spambot Plugin for WordPress comment spam.
This article shows you what I did for DAP, and how you can do it too with a free code download.
What is the Growmap Anti Spambot Plugin (G.A.S.P.)?
For more information, check out the WordPress plugin here.
Simple, clever, and it works.
I decided against captcha forms (because they’re annoying) and opted to learn what I could from G.A.S.P. and make my own system for Digital Access Pass membership signup forms – I’m calling it… D.A.P.A.S.S.
How the Digital Access Pass Anti Spambot System (D.A.P.A.S.S.) works
Currently D.A.P.A.S.S. works by utilizing the G.A.S.P. checkbox functionality and the hidden “honeypot” field.
My approach extends G.A.S.P. to provide for the following simple additions:
- You can have multiple forms on the one page. With the current G.A.S.P. implementation you’re limited to only one G.A.S.P.-enabled form per page.
- I’ve wrapped an HTML ‘<LABEL>’ element around the text beside the checkbox for usability.
- It perhaps may not make any difference, but I’ve slightly randomized the <DIV> ID’s to help reduce the likelihood that there would be a workaround based on ID names.
If you’re using a WordPress theme like Thesis then you’re in luck because adding PHP such as this is a breeze!
Once you make the additions to the sign-up form, you then add a line to the DAP
signup_submit.php file. All is revealed below…
Considerations for Digital Access Pass future upgrades
It would be ideal if DAP had a built-in mechanism for handling SPAM, or even supplied hooks for help developers add their own customizations, but alas, we’re stuck with what we’ve got.
To add server-side checking of the form, you must edit a file that will in all likelihood be updated in future DAP releases. This means that for each upgrade, you have to re-edit the file. This isn’t a huge problem since the changes you need to make go right at the beginning of the file, and the change is only 1 line.
It’s easy! Anyone with a text editor and FTP can do it.
You can download the D.A.P.A.S.S. package for free from the Host Like Toast Developer Channel and it comes in 3 parts.
How to add Digital Access Pass Anti Spambot System to your site
The 3 parts of the download are as follows:
dapass_form.php: a PHP file that you must include somewhere in your theme and then simply call:
dapass_check.php: a PHP file that you must include at the beginning of the file
signup_submit.phpso as to check for SPAM submissions
Review the image below of the form HTML code provided by DAP.
As outlined on the image itself, you need to create a new table row and cell and place the code within it. Styling of the form is left up to you at this point.
Simply call the PHP code:
If you don’t know how to easily call the PHP code within WordPress, you have a couple of options. With the Thesis Theme you can simply create your own function in custom_functions.php and hook it in the appropriate place for the correct page.
You could alternatively create a WordPress “Shortcode” which is quite straight forward to do once you’ve tried it once. I intend to give a quick how-to for this in the future, but feel free to comment below if you’d like help sooner.
The next stage is to edit the
signup_submit.php file as this is critical to the whole functioning of the system. Here is the basic outline of the steps involved:
- Using FTP (or otherwise) browse to your DAP installation folder and download the file:
- Make a backup copy of this file.
- Open up the file you downloaded (not the backup) in a text editor.
- At the beginning of the file (after the
<?php) add the following line of code (as shown in the image below):
include_once ( dirname(__FILE__).'/dapass_check.php');
- Save the file.
- Upload the following files to your DAP installation folder:
signup_submit.php, the backup file of
dapass_check.php. If you’re prompted to overwrite the files, say yes.
All being well, you should have a functional anti spambot facility on your sign-up form.
Of course, I’m open to suggestions on how you think this could be improved, or even simplified, but for now I hope any users of Digital Access Pass will find this a useful addition.
And to the authors of Digital Access Pass… please add the ability to hook into the DAP code in future releases. Developers would really appreciate the ability to extend the system easily without having to edit the source each time (as I did when I added the ability to use Google Apps email to send non-bulk/autoresponder emails in DAP).
If you sign-up to the Developer Channel remember that you are subject to the Terms and Conditions. In summary, Host Like Toast isn’t liable for any damages incurred by implementing our suggestions and guides. Use at your own risk.
Also remember, as I mentioned already, you’ll have to redo the last stage where you edited the
signup_submit.php file after you upgrade your DAP installation in the future.
You can download the code necessary directly from the Host Like Toast Developer Channel today. If you haven’t signed up already, you can do so using the form below.