Log in

View Full Version : Prepared Avatar URL or Thumbnail


Digital Jedi
01-13-2009, 10:42 PM
Is there anyway to get the $prepared[avatarurl] or a user's thumbnail avatar in another template besides the Member Info Templates? And can it be done with just a template edit and without the need for a plugin or product?

Bellardia
01-13-2009, 11:45 PM
I've been unable to find any other way to access it (that's not to be said there isn't a way).

As it seems the only way I think you'll be able to get it is with a plugin, but I still don't know any defined variables that store it.

Dismounted
01-14-2009, 03:40 AM
There is no way to do this without plugins or file edits. If you are wanting to fetch the current user's avatar, set the "AVATAR_ON_NAVBAR" constant to true and use fetch_avatar_from_userinfo(). If you are wanting to fetch another user's avatar, use fetch_avatar_url().

See functions_user.php for both functions.

Digital Jedi
01-14-2009, 04:40 AM
That's too bad. I was hoping to pull the thumbnail as part of a style. Can the regular avatar be displayed using just the style? It seemed I did this once before but I can't seem to find where I tired it.

Dismounted
01-14-2009, 05:17 AM
Can the regular avatar be displayed using just the style?
If avatars are stored in the database, you can use image.php?u=USERID.

Digital Jedi
01-14-2009, 07:03 AM
Hrm, looks like I'll have to breakdown and delve into a working plugin if I want this to work the way I want. This is new territory for me.

I found the fetch_avatar functions, but where is this AVATAR_ON_NAVBAR constant exactly?

Dismounted
01-14-2009, 07:09 AM
You define it as true at init_startup.
define('AVATAR_ON_NAVBAR', true);

Digital Jedi
01-14-2009, 07:35 AM
Oh, I see. The hook. I'm having trouble understanding how I tie it all together. I guess continued PHP tutorials are in order?

Dismounted
01-14-2009, 09:38 AM
A handy tool is a mass search tool (I personally use Actual Search & Replace). Search for "AVATAR_ON_NAVBAR" and you will see what it does.