This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » User management plugins » [SOLVED] How do I print the Username
[SOLVED] How do I print the Username [message #60794] Thu, 11 September 2008 18:53 Go to next message
devtrench  is currently offline devtrench
Messages: 4
Registered: September 2008
Junior Member
Feeling like a real noob right now, but I've got SfGuard set up and working, all I want to do is print out the username like:

You are currently logged in as [username]

This would be in my layout.php template. I'm think I'm missing something really basic since I don't see any docs on this, so can someone just point out how to do this?

I don't have profiles set up for SfGuard and hope I don't have to just to fetch the username. I've tried accessing the BasesfGuardUser::getUsername() method in my controller, but I get a php warning that I shouldn't do that.

Can someone help?

Thanks,

James

[Updated on: Fri, 12 September 2008 04:19]

Re: How do I print the Username [message #60804 is a reply to message #60794 ] Thu, 11 September 2008 20:22 Go to previous messageGo to next message
whalexis  is currently offline whalexis
Messages: 207
Registered: July 2008
Faithful Member
I think you have to use the $sf_user variable in your layout.

Try
$sf_user->getUsername()

I don't know if it work as I don't use SfGuard but it works that way with my own class.

Alexis
Re: How do I print the Username [message #60810 is a reply to message #60804 ] Thu, 11 September 2008 21:23 Go to previous messageGo to next message
devtrench  is currently offline devtrench
Messages: 4
Registered: September 2008
Junior Member
whalexis wrote on Thu, 11 September 2008 20:22

I think you have to use the $sf_user variable in your layout.

Try
$sf_user->getUsername()

I don't know if it work as I don't use SfGuard but it works that way with my own class.

Alexis


Awesome - this worked. I knew it had to be something simple like that. Thanks!
Re: How do I print the Username [message #60813 is a reply to message #60810 ] Thu, 11 September 2008 21:40 Go to previous message
whalexis  is currently offline whalexis
Messages: 207
Registered: July 2008
Faithful Member
You're welcome.

Don't forget to edit your initial post and tag it as solved

Alexis
Previous Topic:sfGuard User Registration
Next Topic:Global is_secure is ON when sfGuard's sfGuardBasicSecurityFilter is used as custom filter
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software