The part causing a problem is:

<?php echo $sf_user ?>

$sf_user is not a string it is an sfGuardUser object. If you want to echo
the username you need to call the getUsername() method on that object:

<?php echo $sf_user->getUsername() ?>

On Thu, Jan 13, 2011 at 3:37 PM, SeNdEr <[email protected]> wrote:

> Hello
>
>  Im building my website with symfony and im using sfguard for user
> management, it works great when im logged in, but when not i get this
> error:
>
>  Fatal error: Call to a member function __toString() on a non-object
> in ..... /sfDoctrineGuardPlugin/lib/user/sfGuardSecurityUser.class.php
> on line 223
>
>  Why?
>
>  I got this in my layout:
>
>  <?php if ($sf_user->isAuthenticated()): ?>
>           <div id="header_der">
>        <p><strong>Bienvenido:</strong> <?php echo $sf_user ?></p>
>
>        <img src="/images/ejemplos/avatar.jpg" alt="Avatar usuario" />
>        <small>Ultimo Acceso: 16-02-2010</small>
>
>        </div>
>        <?php else: ?>
>          <div id="login">
>          <?php  include_component_slot('login');?>
>        </div>
>          <li>
>          </li>
>     <?php endif; ?>
>
> Any ideas?
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
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