The Number type of Custom Profile Field can be used as an effective anti-spambot registering tool. At least for now.
The object is to have a default value which does not match the required value to be able to register.
So find the custom profile field page in your Admin Control Panel.

Numbers Method
Here I have used a set of 5 numbers, from 1 to 5 (only 3 are visible on the picture).

The settings for the "profile type specific options" are as follows.

Note the use of both the highest & lowest as being equal, and the default as not being the same.
It is not required to use just single numbers, they can be something like 1234, 5367, 8746, 9456, 3426.
So long as the number you have chosen as your required, is also set as the highest & lowest number and not the default it will work.
This will effectively allow you to use a 'code'. If wanting to use as a 'code', do not enter any numbers on the first page as examples (the place where I put the numbers 1 to 5). You would need to provide them with some other method of getting your 'code' to be able to enter, such as an email invite to join with the 'code' or placing it within your forums in an open topic, or merely saying in the instructions "Type '1234' into the box", etc.
You should edit the language file which contains the error message returned when they 'fail' so that it does not provide the 'answer'.
To do this edit do the following.
- Code: Select all
#
open langauges/en/ucp.php
#
# repeat for other langauges
#
# Find
#
'FIELD_TOO_SMALL' => 'The value of “%1$s” is too small, a minimum value of %2$d is required.',
'FIELD_TOO_LARGE' => 'The value of “%1$s” is too large, a maximum value of %2$d is allowed.',
#
# Replace with
#
'FIELD_TOO_SMALL' => 'The value of “%1$s” is incorrect',
'FIELD_TOO_LARGE' => 'The value of “%1$s” is incorrect.',
#
# save and close all files
# Remember to clear the cache folder for this to
# take effect.
Result
This is the end result of those two being used together.

Update for ver 3.0.5 and later
Note that there have been some slight changes in version 3.0.5 that slightly change the visibility settings, but also improve the operation of this technique. See viewtopic.php?p=9778455#p9778455
Note re Dropdown method
In prior versions of this article, reference was made to using a Dropdown Custom Profile Field as a spam preventer. This technique has now been cracked by the spambots.
EDIT by stevemaury 1247322250 UTC -5 w/DST to add 3.0.5 update
EDIT by stevemaury 1299022863 UTC -5 w/DST to remove broken dropdown method