This is a skeleton for creating a callback for a custom user field. The callback is used to validate the value entered by the user. For example, if you are collecting some kind of ID that you need to check against another database.
The callback is specified when editing the custom field:
The skeleton contains this file which matches the callback name:
library/Callback/UserField.php
The example code only accepts a value of '123'. Otherwise it defines an error message and returns false. It's a very simple example for demonstration. You can use your own code inside of the validate() function:
The callback is specified when editing the custom field:
The skeleton contains this file which matches the callback name:
library/Callback/UserField.php
The example code only accepts a value of '123'. Otherwise it defines an error message and returns false. It's a very simple example for demonstration. You can use your own code inside of the validate() function:
Code:
<?php
class Callback_UserField
{
public static function validate($field, &$value, &$error)
{
if ($value == '123')
{
return true;
}
else
{
$error = 'what no';
return false;
}
}
}