Customizing SMF > Graphics and Templates

User Avatar

(1/1)

Aaron Nelsen:
I'm updating my old theme and I need to know how to get the avatar displayed for each user.

[Unknown]:
Well, if you don't know PHP, try putting this in your template somewhere:

', $context['user']['avatar'], '

If you do know PHP, it's in that variable I named above ;).

-[Unknown]

Aaron Nelsen:
In Firefox 0.8 it just displays the text "array" when I use that when I'm logged in. And when I log out it gives me this error
--- Quote ---Notice: Undefined index: avatar in /home/r181471/public_html/forum/Themes/test/index.template.php on line 226
--- End quote ---

[Unknown]:
I'm sorry, I'm sorry... forgot that it changed.  In fact, I changed it.  Boy does that make me quick, eh?

You want:

', $context['user']['is_guest'] ? '' : $context['user']['avatar']['image'], '

-[Unknown]

Aaron Nelsen:
Thanks man, works like a charm! SMF freaking rocks!

Navigation

[0] Message Index

Go to full version