Exemplo n.º 1
0
 /**
  * Edit Users Profile
  */
 public function actionEdit()
 {
     $user = Yii::$app->user->getIdentity();
     // Get Form Definition
     $definition = $user->profile->getFormDefinition();
     $definition['buttons'] = array('save' => array('type' => 'submit', 'label' => Yii::t('UserModule.controllers_AccountController', 'Save profile'), 'class' => 'btn btn-primary'));
     $form = new \humhub\compat\HForm($definition, $user->profile);
     $form->showErrorSummary = true;
     if ($form->submitted('save') && $form->validate() && $form->save()) {
         // Trigger search refresh
         $user->save();
         Yii::$app->getSession()->setFlash('data-saved', Yii::t('UserModule.controllers_AccountController', 'Saved'));
         return $this->redirect(Url::to(['edit']));
     }
     return $this->render('edit', array('hForm' => $form));
 }