No, I’m not talking about this blog. I’ve installed some nice spam protections on this WordPress blog (anti trackback spams and the comment form with captcha). I’m talking about Menalto Gallery, one of the best Open Source PHP Gallery out there.
I have Gallery installed here on my domain (you can go to my photo gallery through www.cravingtech.com). I remembered posting a link about my Melbourne Zoo photos some weeks ago on an Australian forum, so I was curios to know how many people viewed the album. So yeah, the album got 26,459 hits but also had 66,731 spam comments as a free bonus.
So if you have the PHP Menalto Gallery installed on your site, here are the steps that you need to do to clean and stop the spam for good!
Cleaning current spam comments on Gallery
Note: This mini guide assumes that you understand a bit about SQL queries.
To remove your current spam comments, you need to go to the databae. If your hosting gives you a cPanel, you can usually go to your database using phpMyAdmin. Once there, go to your gallery database (gallery2 by default) and then go to the table called g2_Comment. This is the table that stores all comments in your Gallery.
If you haven’t had real comments before, you can easily empty the table to clean all the junk comments. However, if there were real comments, then it’d be harder.
You can use an SQL query to clean the table. For example, if your last legitimate comment is up to g_id 4475, you can use an SQL Query: “DELETE FROM g2_Comment WHERE g_id > 4475” as you can see from my screenshot below:
Play around with the SQL queries to filter the real comments with the spam comments.
Installing anti spam comments on Gallery
To prevent more spam comments on your Gallery:
- Install the Captcha plug-in on your Gallery.
Search and download the captcha plug-in through your Gallery’s administration plug-in panel. Activate it and change its default settings:
You can go paranoid and set all of them to High (Captcha must be entered for every guests and users). However, this is not enough. It will eliminate most spams, but unfortunately, some bots who can recognize the captcha images will still spam your Gallery. In this case, you’ll still need to install the second plug-in, called Akismet.
- Install Akismet on your Gallery.
To do this, you need to make sure that:
– You have updated your Gallery to the latest version.
– You have updated the Comments plug-in module to the latest verison.
– Enter your Akismet API key on the Comments module settings to activate it. If you haven’t had one, you need to go to Akismet.com to get one. If you have signed up for a WordPress.com account, you can also use your WordPress.com API key on Gallery.
That’s it! Enjoy a spam-free Gallery!