Jump to main content Jump to doc navigation

The spam hook

The spam hook will check all the fields specified in the property spamEmailFields against a spam filter via StopForumSpam. If the user is flagged as a spammer, it will show an error message for that field checked.

The spam hook requires either cURL or Sockets support in your PHP installation (The same requirements for Package Management).

Available Properties

name description
spamEmailFields Optional. A comma-delimited list of email fields to check. Defaults to 'email'.
spamCheckIp If true, will also check the IP of the submitter. Defaults to false.


Simply specify the "spam" hook in your FormIt call. FormIt will handle the rest.

[[!FormIt? &hooks=`spam`]]

Checking the IP For Spam

Although it is strongly recommended not to use the IP for spam checking (since spammers can easily change IP addresses, and checking IPs often gives false positives), FormIt provides you the option. Just set the &spamCheckIp value to 1 on your FormIt call.

See Also

  1. FormIt.Hooks.email
  2. FormIt.Hooks.FormItAutoResponder
  3. FormIt.Hooks.FormItSaveForm
  4. FormIt.Hooks.math
  5. FormIt.Hooks.recaptcha
  6. FormIt.Hooks.redirect
  7. FormIt.Hooks.spam
  8. FormIt.PreHooks.FormItLoadSavedForm

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.



$0 per month—let's make that $500!

Learn more