yii2-user
yii2-user copied to clipboard
How to get Full Name?
Hi, I'm trying to get a users full name (not username/email etc)
I've tried using "$fullusername = Yii::$app->profile->full_name;" however Yii throws an error saying it can't find the class. Is there an easy way to pass this info through to a view?
PS: Accidentally clicked enter after I wrote my title, sorry if I sent you an empty question!
The full_name is set in the profile, so you would need to access the user -> profile. You can do that by using
$fullusername = Yii::$app->user->identity->profile->full_name;
where
user = Yii user component
identity = User model
profile = Profile model
I see! That works, thanks for the exceptionally quick response!