/**
  * Shows user's profile.
  * @param  integer $id
  * @return \yii\web\Response
  * @throws \yii\web\NotFoundHttpException
  */
 public function actionShow($id)
 {
     $profile = $this->finder->findProfileById($id);
     if ($profile === null) {
         throw new NotFoundHttpException();
     }
     return $this->render('show', ['profile' => $profile]);
 }
 /**
  * Shows profile settings form.
  * @return string|\yii\web\Response
  */
 public function actionProfile()
 {
     $model = $this->finder->findProfileById(\Yii::$app->user->identity->getId());
     $this->performAjaxValidation($model);
     if ($model->load(\Yii::$app->request->post()) && $model->save()) {
         \Yii::$app->getSession()->setFlash('success', \Yii::t('users', 'Profile settings have been successfully saved'));
         return $this->refresh();
     }
     return $this->render('profile', ['model' => $model]);
 }
 /**
  * Updates an existing User model.
  * If update is successful, the browser will be redirected to the 'index' page.
  * @param  integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $user = $this->findModel($id);
     $user->scenario = 'update';
     $profile = $this->finder->findProfileById($id);
     $r = \Yii::$app->request;
     $this->performAjaxValidation([$user, $profile]);
     if ($user->load($r->post()) && $profile->load($r->post()) && $user->save() && $profile->save()) {
         \Yii::$app->getSession()->setFlash('success', \Yii::t('users', 'User has been updated'));
         return $this->refresh();
     }
     return $this->render('update', ['user' => $user, 'profile' => $profile, 'module' => $this->module]);
 }