Doesn't [ensure_user_name_valid](https://github.com/mantisbt/mantisbt/blob/master-1.2.x/core/user_api.php#L308) contain all the needed information?