• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

[question]Call back in custom user Field

Jake Bunce

XenForo moderator
Staff member
#2
I don't see it documented anywhere. It really should be. But I figured it out.

An example is attached. Once you have uploaded the files then you need to specify the callback for your profile field:

Screen shot 2012-01-12 at 10.51.04 PM.png

Then edit the code:

library/Callback/UserField.php

It has a basic skeleton you can use to validate the value of a profile field:

Code:
<?php

class Callback_UserField
{
	public static function validate($field, &$value, &$error)
	{
		if ($value == '123')
		{
			return true;
		}
		else
		{
			$error = 'what no';
			return false;
		}
	}
}
 

Attachments