Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not update user status #10

Closed
cansozeri opened this issue May 12, 2014 · 2 comments
Closed

can not update user status #10

cansozeri opened this issue May 12, 2014 · 2 comments
Labels

Comments

@cansozeri
Copy link
Contributor

Hello,

Thanx for great module.

I can not update user status when I use the actionUpdate controller, Nothing happend and status not changed after I submit the form. I think I have to add a setAttribute in the controller or something else, because load($_post) is not update the $model->status. What can I do that ?? Am I missing something ??

By the way I added the auth role code in your update and create controllers, because I could not find a class for that in your module as shown below. Is it the right way to do this ??

Regards,

public function actionUpdate($id){

        $model = $this->findModel($id);

    if ($model->load($_POST) && $model->save()) {

        /*Auth Role save*/
        $authManager=new DbManager;

        /*Control Role Type if exists assign*/
        $sonuc = $authManager->getRole($_POST['User']['role']);

        if($sonuc!==null)
        {
            $authManager->revokeAll($model->id);
            $authManager->assign($sonuc,$model->id);
        }

        return $this->redirect(['view', 'id' => $model->id]);
    } else {
        return $this->render('update', [
            'model' => $model,
        ]);
    }
}
@cansozeri
Copy link
Contributor Author

I have found a solution for this. We need to add a rule on user model for this.

['status', 'safe']

@robregonm robregonm added the bug label May 13, 2014
robregonm added a commit that referenced this issue May 13, 2014
@robregonm
Copy link
Owner

Fixed. Thanks for reporting :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants