Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get Full Name? #201

Open
joshcawthorne opened this issue Jan 5, 2018 · 2 comments
Open

How to get Full Name? #201

joshcawthorne opened this issue Jan 5, 2018 · 2 comments

Comments

@joshcawthorne
Copy link

joshcawthorne commented Jan 5, 2018

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!

@amnah
Copy link
Owner

amnah commented Jan 5, 2018

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

@joshcawthorne
Copy link
Author

I see! That works, thanks for the exceptionally quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants