commands/ConfirmController.php
public function actionIndex($search)
    {
        $user = $this->finder->findUserByUsernameOrEmail($search);
        if ($user === null) {
            $this->stdout(\Yii::t('user', 'User is not found') . "\n", Console::FG_RED);
        } else {
            if ($user->confirm()) {
                $this->stdout(\Yii::t('user', 'User has been confirmed') . "\n", Console::FG_GREEN);
            } else {
                $this->stdout(\Yii::t('user', 'Error occurred while confirming user') . "\n", Console::FG_RED);
            }
        }
    }
public function actionIndex($search)
    {
        $user = $this->finder->findUserByUsernameOrEmail($search);
        if ($user === null) {
            $this->stdout(\Yii::t('user', 'User is not found') . "\n", Console::FG_RED);
        } else {
            if ($user->confirm()) {
                $this->stdout(\Yii::t('user', 'User has been confirmed') . "\n", Console::FG_GREEN);
            } else {
                $this->stdout(\Yii::t('user', 'Error occurred while confirming user') . "\n", Console::FG_RED);
            }
        }
    }
public function actionIndex ( $ search ) { $ user = $ this -> finder -> findUserByUsernameOrEmail ( $ search ) ; if ( $ user === null ) { $ this -> stdout ( \ Yii :: t ( 'user' , 'User is not found' ) . "\n" , Console :: FG_RED ) ; } else { if ( $ user -> confirm ( ) ) { $ this -> stdout ( \ Yii :: t ( 'user' , 'User has been confirmed' ) . "\n" , Console :: FG_GREEN ) ; } else { $ this -> stdout ( \ Yii :: t ( 'user' , 'Error occurred while confirming user' ) . "\n" , Console :: FG_RED ) ; } } }
Confirms a user by setting confirmed_at field to current time.

@param string $search Email or username
Confirms a user by setting confirmed_at field to current time .