I just want to add Profile in navbar for logged user. And I found /user/profile/show in dektrium yii2-user docs.
But it said:
Displays user's profile (requires id query param)
How to implement /user/profile/show in label that requires id query param?
Thanks in advance
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Signup', 'url' => ['/user/registration/register']];
$menuItems[] = ['label' => 'Login', 'url' => ['/user/security/login']];
} else {
$menuItems[] = ['label' => 'Profile', 'url' => ['/user/profile/show']];
$menuItems[] = '<li>'
. Html::beginForm(['/user/security/logout'], 'post')
. Html::submitButton(
'Logout (' . Yii::$app->user->identity->username . ')',
['class' => 'btn btn-link']
)
. Html::endForm()
. '</li>';
}
When I use code above and click the Profile navbar, it said Bad Request (#400), Missing required parameters: id. Yea I know becuse of the id query param isn't defined.