DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Use wt_spamshield with default (TYPO3) mailform

Preface

There are different settings regarding the TYPO3 version you are using. In TYPO3 4.6 the default mailform extension was completely rewritten in extbase. With the new extension called tx_form many things have changed and you have to configure wt_spamshield differently. Regardless the TYPO3 version you are using - even in TYPO3 6.1 - it's possible to use the old default mailform (core) instead of the sysext tx_form. In TYPO3 7.1 the old mailform has been moved to the compatibility6 extension.

Add a new page

Create a new page (maybe hidden in the navigation) and enter a text which should be shown if spam was recognized.

img-7

Add static template (tx_form not installed)

Add the static template "Default Mailform (wt_spamshield)". This step is only possible if you did NOT install tx_form. If you have installed tx_form there will be no static template in the list.

img-8

Add TypoScript Constants

plugin.wt_spamshield.mailform = 1
plugin.wt_spamshield.honeypot.inputname.standardMailform = uid987651
plugin.wt_spamshield.redirect_mailform = http://www.yourpage.com/index.php?id=14

TypoScript explanation

With the first line you can enable or disable the plugin on different pages.

The second line defines the name of the honeypot field. This name is especially important if you use tx_form. If you are using the old mailform and you want to change the name of the field also keep in mind to adjust another TypoScript snippet. The file can be found under /wt_spamshield/Configuration/TypoScript/Extensions/defaultmailform/se tup.txt. So if you want to change the name also change the innerWrap of the following snippet. For further information see the corresponding ticket on forge ( http://forge.typo3.org/issues/53618 ).

tt\_content.mailform.20.stdWrap {
  innerWrap = | <input name="uid987651" type="text" autocomplete="off" style="position: absolute; margin: 0 0 0 -9999px;" value="" />
}

With the third line you define to which URL the user will be redirected if spam was recognized. Enter a fully qualified URL !

Special field configuration (TYPO3 >= 4.6)

To use wt_spamshield with tx_form you have to configure your own validation rules. Open the content element which stores the configuration of the specific form. On the second tab "Form" you have to add rule sets like the following one:

...
30 = TEXTAREA
30 {
  cols = 40
  rows = 5
  name = msg
  label {
    value = Message
  }
}
40 = TEXTLINE
40 {
  name = uid987651
  label {
    value = Sweet pot
  }
}
...
rules {
  1 = wtspamshield
  1 {
    element = msg
  }
  2 = wtspamshield
  2 {
    element = uid987651
  }
}

The snippet configures two fields; one for a textarea (name="msg") and one for an input field (name="uid987651") used for the honeypot. In the second part of the snippet we create rules for each and every field we want to check with wt_spamshield. Internally wt_spamshields processes the whole validation chain for each field you define in this section (http check, honeypot check, Akismet etc.).

If you want to use the honeypot check you have to create the corresponding field manually (see code snippet above) within your form. Please make sure that the field name is also configured in wt_spamshield:

plugin.wt_spamshield.honeypot.inputname.standardMailform = uid987651

Furthermore you have to hide the field by using CSS (we assume the honeypot input field has the id="field-5"). Please also keep in mind that tx_form starts the field counter from 1 for each form/ content element.

#field-5 { position:absolute; margin:0 0 0 -999em; }