Arrow

plugin not working | Peter's Custom Anti-Spam for WordPress | Forum

Back to the custom anti-spam plugin page
 
Current User: Guest
Search Forums:


 






Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

plugin not working

Reply to Post Add a New Topic
UserPost

9:33 am
October 15, 2008


Stephane

Guest

I have installed the plugin without any problems. When i enter the wrong word, the error message and the textarea are now in a new blank page. Can anyone help me

Stephane

2:22 pm
October 15, 2008


Peter

Admin

posts 732

Hi Stephane, that is actually the default behavior D

If you want some “same page” feedback then you’ll have to do your own JavaScript or Ajax modifications. If you want something like what I do on my site (new page feedback but integrated into the site design), you’ll have to develop some extra templates. I’ve been meaning to create a tutorial on the template workflow, but haven’t gotten around to that (

9:40 am
October 16, 2008


Stephane

Guest

Hi,

i wanted to say that the only part of the page displayed is the error message and the textarea, all other part is absent

Stephane

11:18 am
October 16, 2008


Peter

Admin

posts 732

Hi, yes that is the default behaviour.

1:06 am
October 19, 2008


Peter

Admin

posts 732

In a nutshell, this is how I created the "friendlier anti-spam" error pages for the plugin on theblog.ca. I don't wish to give specific template instructions because the nuances of the template code would be different for each person's theme.

1. Tweak the way the plugin processes anti-spam word errors

Instead of the die() commands in the plugin, make WordPress load some custom error template files. In wp-content/plugins/custom-anti-spam/custom_anti_spam.php:

Replace:

if ( $securitycode == '' )
{
die("<p>{$cas_displaytext['emptyfield']}</p>\\n<p>{$cas_displaytext['copyfield']}</p>\\n<textarea cols=\\"100%\\" rows=\\"10\\" onclick=\\"this.select();\\" readonly=\\"true\\">$commentbody</textarea>");
}

With:

if ( $securitycode == '' )
{
include (TEMPLATEPATH . '/comments-error.php');
exit();
}

Replace:

// If this row doesn't exist, say something
if (is_null($matchthis)) die("<p>{$cas_displaytext['alreadyused']}</p>\\n<p>{$cas_displaytext['copyfield']}</p>\\n<textarea cols=\\"100%\\" rows=\\"10\\" onclick=\\"this.select();\\" readonly=\\"true\\">$commentbody</textarea>");

With:

// If this row doesn't exist, say something
if (is_null($matchthis)) {
include (TEMPLATEPATH . '/comments-expired.php');
exit();
}

Replace:

if ( strtolower( $matchthis ) != strtolower( $securitycode ) )
{
die("<p>{$cas_displaytext['wrongfield']}</p>\\n<p>{$cas_displaytext['copyfield']}</p>\\n<textarea cols=\\"100%\\" rows=\\"10\\" onclick=\\"this.select();\\" readonly=\\"true\\">$commentbody</textarea>");
}

With:

if ( strtolower( $matchthis ) != strtolower( $securitycode ) ) {
include (TEMPLATEPATH . '/comments-error.php');
exit();
}

2. Create custom error templates

Create some templates comments-error.php and comments-expired.php. These should contain the comment form from your default theme, the header, sidebar, and footer as required by a full page, and some descriptive error text. If you can get this part right, users are presented with an error page but a blank form.

3. Fill in the error templates' comment form with the posted information.

For each field in your form (name, e-mail address, comment, etc.) print the values of the posted information, so that users don't have to enter their information again. For example, the code for the name field would look like this:

<p><input type="text" name="author" id="author" value="<?php print stripslashes(htmlentities($_POST['author'],ENT_QUOTES)); ?>" size="22" tabindex="1" />
<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
Reply to Post

Reply to Topic:
plugin not working

Guest Name (Required):

Guest Email (Required):

HTML Editor
Smileys
Confused Cool Cry Embarassed Frown Kiss Laugh Smile Surprised Wink Yell
Post New Reply

Guest URL (required)

Math Required!
What is the sum of:
3 + 4