Showing user avatar on every page after login

Permalink
How is it possible to show the profile picture of a logged in user on every page like for instance social networks do in the head panel. What I did was placing this line of php code into all of my theme pages that way it looks like in the profile.php (of course only after a user being logged in):
<a href="<?php echo $view->url('/members/profile')?>" class="profile-thumbnail enter-profile"><?php print Loader::helper('concrete/avatar')->outputUserAvatar($profile); ?><span><?php echo ($profileName); echo ($u->getUserName())?></span></a>


With that it is possible to head to your profile on every page but it fails at constantly displaying the profile picture. It just shows the default avatar. Profile pictures are only loaded while viewing a public profile. If I then open up an other user's profile I get his profile picture displayed. So it doesn't get the unique username and no customized avatar on other pages either.
What do I have to do to get this working?

View Replies:
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi Rennsemmel,

Your questions relating to avatars and the conversation block are interesting.

If there is no follow up from anyone, I would look into the bug tracker.
WillemAnchor replied on at Permalink Reply
WillemAnchor
That helper needs UserInfo. Try something like this:

use Concrete\Core\User\UserInfo as UserInfo;

$ui = UserInfo::getByID($uID);
echo Loader::helper('concrete/avatar')->outputUserAvatar($ui);
Rennsemmel replied on at Permalink Reply
Thank you very much for your responses. Unfortunately, with your code snippet of which I thought it should have done the job it still behaves like before. It seems there are no read rights outside profile pages.

I've pasted the use clause to the beginning of my theme and the other code into where it shall display the avatar.
Rennsemmel replied on at Permalink Reply
Finally I got this working. What was missing is
$ui = UserInfo::getByID($u->getUserID());
titanve replied on at Permalink Reply
titanve
Hello,

Where did you get the $u in $u->getUserID() ?

Thank you
MrKDilkington replied on at Permalink Reply
MrKDilkington
@titanve

The $u is a new User object.
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
titanve replied on at Permalink Reply
titanve
Hello,

How do you setup the environment in order to check if a user is registered before processing a RESTful request with slim framework. I used to do it in ver. 5.6, but now I can get isRegistered() when I call it.