Zenphoto Spam Protection
Foreword
In my experience, no method can prevent spam 100%. This applies not only to Zenphoto, but also to Piwigo, WordPress, and others.
Spam bots have become so sophisticated that even a CAPTCHA is no longer a real obstacle.
Nevertheless, there are a few methods to at least make it more difficult for spam comments to be posted.
Here are a few tips on how to set up basic spam protection with Zenphoto. Zenphoto comes with a few plugins for this purpose.
Re-Captcha
I would be cautious about activating this plugin, as it is at least questionable from a data protection standpoint. The plugin sets some cookies, so you should configure the Cookie Consent plugin accordingly. In addition, Google’s reCAPTCHA integrates Google Fonts and, to the best of my knowledge, transmits some data to Google’s servers in the U.S.
Since this seems too “risky” to me, I’m choosing not to use it.
Simple Spam
This plugin uses a blacklist and suspicious URL patterns to determine whether a post is spam. Since such a blacklist will never be complete, I disabled the plugin after running a few tests and am using the Trivial Spam plugin instead.
Trivial Spam
To be honest, I use this plugin more as a moderation plugin, so I've set the settings to "Moderate." This ensures that all comments are published only after being approved in the backend. With a manageable number of comments, this doesn't really add much extra work. For high-traffic sites with dozens of comments every day, I’d give the Simple Spam plugin another try.
So far, the plugins have focused more on comments than on the contact form. With the Captcha plugin disabled, contact emails are forwarded exactly as they are. The requirement to confirm the data transfer isn't really an obstacle to spam emails.
Spam Protection Contact Form
In this section, I'll show you how to integrate a admittedly simple spam protection feature into the contact form.
Assuming your theme doesn’t come with its own contact form (as far as I know, Paradigm uses its own form), the file for the contact form is located in this directory:
Path_to_Zenphoto_Installation\zp-core\zp-extensions\contact_form\
There is exactly one file there: form.php
We will be editing these below, so be sure to create a backup copy!!
Now open this file in a text editor, such as Notepad++.
We would now like to insert a short security prompt after the message text and before the user consents to the data transfer. The code for the message text begins on line 126 with:
<p class="mailmessage">
and ends on line 129 with the closing p tag:
</p>
Now insert the following code after line 29:
<p>
<label for="subject"><?php echo gettext("Security question:<strong>*</strong>"); ?></label>
<label ="Capital">
<input type="text" name="SecurityQuestion" pattern="Berlin" placeholder="The capital of Germany is:" size="50" required>
</label>
</br>
</p>
This adds a new required text field to the contact form. This text field contains a placeholder indicating the question to be answered:
The "pattern" specifies what content must be entered into the text field. If the entry is not “Berlin,” the form will not be submitted, and the browser will display a corresponding message.
You can change the question however you like—for example, if you'd rather ask about the capital of Italy or the highest mountain in Germany :-)
More articles about Zenphoto can be found here.
Comments
No Comments
Add a comment:
Subscribe to comments