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):
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?
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?
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);
use Concrete\Core\User\UserInfo as UserInfo;
$ui = UserInfo::getByID($uID);
echo Loader::helper('concrete/avatar')->outputUserAvatar($ui);
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.
I've pasted the use clause to the beginning of my theme and the other code into where it shall display the avatar.
Finally I got this working. What was missing is
$ui = UserInfo::getByID($u->getUserID());
Hello,
Where did you get the $u in $u->getUserID() ?
Thank you
Where did you get the $u in $u->getUserID() ?
Thank you
@titanve
The $u is a new User object.
The $u is a new User object.
$u = new User(); $ui = UserInfo::getByID($u->getUserID());
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.
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.
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.