ariratic
(Ari Ratic86)
March 10, 2014, 5:43pm
1
in views/layout/main.php I try write like this :
'label' =>Yii::app()->getModule('user')->t("Welcome").' '.Yii::app()->getModule('user')->user()->profile->firstname.' ',
but it get error message like this :
Trying to get property of non-object .
please, help me to figure out.
thanks in advance
alirz23
(Alirz23)
March 10, 2014, 6:00pm
2
have you configured the module?
are you logged in?
<?php
Yii::app()->getModule('user')->user()->profile->firstname
// expects you to be logged in if not returns false;
dump your complete stack trace
ariratic
(Ari Ratic86)
March 11, 2014, 12:08am
3
hoo…you right…bro
when logged in it run but when logged off not run.
what should I do? where is part configure the module?
please,
thanks in advance
alirz23
(Alirz23)
March 11, 2014, 3:56am
4
if its working when you logged its likely you have already configured it
<?php
// only display the username when user is logged in
if (!Yii::app()->user->isGuest) {
Yii::app()->getModule('user')->user()->profile->firstname
}
ariratic
(Ari Ratic86)
March 11, 2014, 4:37am
5
alirz23:
if its working when you logged its likely you have already configured it
<?php
// only display the username when user is logged in
if (!Yii::app()->user->isGuest) {
Yii::app()->getModule('user')->user()->profile->firstname
}
I try like this :
'label' =>Yii::app()->getModule('user')->t("Welcome").' '.if (!Yii::app()->user->isGuest) {Yii::app()->getModule('user')->user()->profile->firstname.' '},'visible'=>!Yii::app()->user->isGuest,
still can’t run before I logged in…bro
I am using widget.bootstrap.TbMenu in /views/layout/main.php
thanks in advance