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

Get the name a user is registering with on PHP Callback

Discussion in 'XenForo Development Discussions' started by Starfire1337, Mar 3, 2015.

  1. Starfire1337

    Starfire1337 Member

    I currently have a small script which will check the custom field and username against a database before letting a user register an account on my forum. However, I never really found an option to get the current username someone has typed in on the registration page - I had to insert my code in the middle of Register.php.

    Is there some way I could the username someone is currently registering with within a PHP Callback from a custom field?

    Thanks!
     
  2. digitalpoint

    digitalpoint Well-Known Member

    The cleanest way to do it would be to extend the User DataWriter (XenForo_DataWriter_User), and specifically the
    _verifyUsername() method. There's already a mechanism that validates the username as they type it in the registration form (for example validating that it's not already in use). So you could hook into the _verifyUsername() method and do whatever other custom validation you want to do.
     

Share This Page