/**
  * User page.
  *
  * @param string $username Username
  */
 public function actionView($username)
 {
     if (($model = User::findByUsername($username, 'active')) !== null) {
         return $this->render('view', ['model' => $model]);
     } else {
         throw new HttpException(404);
     }
 }
Example #2
0
 /**
  * Finds user by username.
  *
  * @return User|null User instance
  */
 protected function getUser()
 {
     if ($this->_user === null) {
         $scope = $this->scenario === 'admin' ? ['admin', 'active'] : 'active';
         $this->_user = User::findByUsername($this->username, $scope);
     }
     return $this->_user;
 }