質問

I'm new to Yii framework. I have a user table which has username and password. I'm using the update page of user to reset password. Now, when I login with username and password I get a menu item as "password-reset" . When I click on this I like to get the update page of user who has logged in. Below is the code in main.php:

array('label'=>'Password-Reset', 'url'=>array('user/update'),'visible'=>(!Yii::app()->user->isGuest && Yii::app()->user->name=="admin"))

But , when I click this I get error 404. When logged in as test I should get the update page of test when I click "Password-Reset" menu item. How can I do this.

役に立ちましたか?

解決

Add the user id to the link:

array('label'=>'Password-Reset', 
      'url'=>array('user/update/'.Yii::app()->user->id),
      'visible'=>(!Yii::app()->user->isGuest)
)

他のヒント

you get this Error 404 Unable to resolve the request "user/update" am i correct. The controller action missing or the user id was not passed on this url check the action .if you dont have action then put one action for update the password like

public function actionUpdatePassword()

{ $useridid=Yii::app()->user->id;

  //code here to update password 

}

url for accessing this action

array('label'=>'Password-Reset', 'url'=>array("user/updatePassword"));

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top