Ext. User

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

  1. have you configured the module?

  2. 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

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

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