1. 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

Discussion in 'XenForo Development Discussions' started by DroidHost, Jan 12, 2012.

  1. DroidHost

    DroidHost Well-Known Member

    Call back in custom user Field
    can any body give me an Example for using such a feature because I cannot understand it
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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;
    		}
    	}
    }
    
     

    Attached Files:

    DroidHost likes this.

Share This Page