Good Morning,
I want to implement this code into my site where i want to get the avatar from the article author and the lastname.
First i get the avatar from the article author. This works perfect!
<?php if(($user = $site->user($article->author())) && ($avatar = $user->avatar())): ?>
<?php echo thumb($avatar, array('width' => 25, 'height' => 25, 'crop' => true)) ?>
<?php endif ?>
No i want to check if the Lastname is set and if not then i want to return the normal username.
<?php if($site->user($article->author())->lastName() != null): ?>
<?= $site->user($article->author())->lastName() ?>
<?php else: ?>
<?= $article->author() ?>
<?php endif ?>
But i always get this following error on that line: Call to a member function lastName() on null
<?php if($site->user($article->author())->lastName() != null): ?>
What do i wrong?
Thanks
Florian