MyBB Community Forums

Full Version: Make a link to users avatar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible somehow to make a link to the users avatar which I can use on another custom script.

I would like the link to the avatar image to be something like this:
http://www.domain.com/avatars.php?uid=1
or
http://www.domain.com/avatars.php?username=admin

Is it possible to do one of those, or maybe both of those somehow?

The first should show the avatar for the user id 1.
The second should show the avatar for the username admin.
Only if they were uploaded to the server, like so:

http://community.mybb.com/uploads/avatar..._28083.png
http://community.mybb.com/uploads/avatar...32041.jpeg

Whereas the numbers are the user's uid. However, if you have the avatar hosted somewhere and you opted to link to it instead of uploading it (like I did), it won't work. Try replacing the uid with mine:

http://community.mybb.com/uploads/avatar...16693.jpeg

It doesn't work because I didn't upload the avatar to the server.

Also, there's an additional parameter (?dateline=) that is defined by MyBB in avatar URLs which forces the browser to show the avatar relative to that dateline (thus not caching it). Since you can't easily know the dateline of when the avatar was uploaded, the image might show up outdated. And that's about all you can do without the use of a plugin or something.