XF 2.1 ucfirst username while/after registration?

Robert9

Well-known member
Is this the right way to ucfirst a username during registration?

Code:
<?php

namespace Robert9\ChangeRegister\XF\Pub\Controller;

use XF\Mvc\ParameterBag;

class Register extends XFCP_Register {

    protected function finalizeRegistration(\XF\Entity\User $user)
    {
        $user->username = ucfirst($user->username);
        $user->fastupdate('username', $user->username);

        parent::finalizeRegistration($user);
    }
}
 
Back
Top Bottom