Exemplo n.º 1
0
 /**
  * Creates a new YBoardMember model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionAssociate($id)
 {
     if (!Yii::$app->user->can('app.forum.member.associate')) {
         throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.'));
     }
     $model = YBoardMember::findOne($id);
     if ($model == null) {
         $model = new YBoardMember();
     }
     $model->setAttribute('id', $id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }