Hey Pierre,

$sf_user->getGuardUser()->getUsername() works for me. Did you do the
whole myUser.class.php thing (
http://trac.symfony-project.com/wiki/sfGuardPluginFor10#Secureyourapplication
) ? Can you check that $sf_user is an object of class myUser and that
myUser.class.php extends sfGuardSecurityUser?

Cheers,
Georg

Pierre schrieb:
>> $sf_user->getGuardUser()->getUsername()
>>
>> I think.
> 
> Yeah, that's how it should be. But apparently the getGuardUser-method  
> returns an empty variable and I can't figure out why. A logged-in  
> user would be supposed to have all the associated data of the user- 
> table at hand, isn't it?
> 
> Pierre
> 
>> -----Original Message-----
>> From: symfony-users@googlegroups.com [mailto:symfony- 
>> [EMAIL PROTECTED]
>> On Behalf Of Pierre
>> Sent: 07 March 2008 17:05
>> To: symfony users
>> Subject: [symfony-users] sfGuard: getUsername in template
>>
>>
>> Hi folks,
>>
>> might be a dumb question but how can I get the username of an
>> authenticated user in my template?
>>
>> I use symfony 1.0.7 and just installed sfGuardPlugin. So far
>> everything works fine but when i want to output the name of the
>> currently logged user like this:
>>
>> <?php echo $sf_user->getUsername() ?>
>>
>> I get the following error:
>>
>> Fatal error: Call to a member function getUsername() on a non-object
>> in /Users/ralf/Sites/picit/plugins/sfGuardPlugin/lib/user/
>> sfGuardSecurityUser.class.php on line 139
>>
>> I configured everything as far as I can see like described in the
>> sfGuardPluginExtraDocumentation.
>> I can login and logout and everything is kind of secure, but I don't
>> get the user object.
>>
>> Any suggestions?
>>
>> Thanks,
>> Pierre
>>
>>
>>
>>
>>
> 
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to