TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,026
  • Total Topics: 21,333
  • Online today: 916
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 236
  • Total: 237
  • @rjen

avatar in a block

Started by gijs, November 09, 2005, 10:04:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gijs

I'm looking for a way to show just the members avatar in a block without hacking in the files. What would be the way to call it from, let's say, a php-block?

bloc

Just the member that is looking? or many members?

Tippmaster

' ,$context['member']['avatar'],'

i think. i dont feel like actually looking.

bloc

its "user" not "member".... In a php block you might need a global too, like:


global $context;

if (!empty($context['user']['avatar']))
echo $context['user']['avatar']['image'];
else
    echo 'no avatar';


just added a check to show a text or another image if avatar is not chosen - just looks better than a empty block. ;)

now, this of course assume its the current member that it will show, doing it for other members is more complex. ;)

gijs

yep I was looking for the current member-avatar. Will try now to see if it works

Xarcell

Is there a way to show a random avatar and member name?

gijs

Quote from: gijs on November 09, 2005, 01:06:27 PM
yep I was looking for the current member-avatar. Will try now to see if it works

It works! thanx!

gijs

is there an easy way to also display the member's personal text under the photo?

Tippmaster

Quote from: Bloc on November 09, 2005, 12:12:01 PM
its "user" not "member"

oops. my bad.
Quote from: gijs on November 09, 2005, 07:30:25 PM
is there an easy way to also display the member's personal text under the photo?

blocs code with personal text added.

global $context;

if (!empty($context['user']['avatar']))
echo $context['user']['avatar']['image'];
else
    echo 'no avatar';
echo' <br/>', $context['member']['blurb'], '';



gijs

#9
displays the avatar, but no personal text....

(my personal text is set and displays fine in posts)

This website is proudly hosted on Crocweb Cloud Website Hosting.