Accessing username in setCustomFields()

Trying to validate a custom field at registration. By looking at the code, setCustomField() appears to be where this field is validated (correct me if I'm wrong)

Now whether or not the input is valid depends on the username, this is also why I don't use a PHP callback for this. Is there a way I can access the username from this function?

Thanks for the suggestion, does not work though ($this->get('username') was not set).
The validation occurs at the registration form, so the user hasn't signed up yet.
Last edited: