• 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

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?



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.