Customizing SMF > SMF Coding Discussion

SMF 2.0.2 Change avatar display

(1/2) > >>

Flynnn:
Is there any way to simply change how SMF displays its avatars everywhere?


Instead of displaying a user's avatar, we would like to get an image from Minotaur (Yes, I am working with Scungilli if you have seen his post) based on the user's username. However after HOURS going through the sourcecode, I have come to a sad conclusion -- There is no single place where I would have to edit the code to change what image is loaded!


I would like to get some advice on what the best way to change how the image urls for avatars are generated/loaded. Thankyou!

Sorck:
If you only wanted users to be able to get these avatars then you could simply strip out the avatar editing part of the profile so they couldn't change it.

I think it would then be as simple as setting the `avatar` column in {db_prefix}members to point to the new avatars. However you'd want to make sure they actually existed. :P

However, please try this on a local test site before actually changing anything no your live site.

Flynnn:
Oh, okay! Thanks a ton! And is there any way we can also set that column on ever user registration?

Sorck:
http://wiki.simplemachines.org/smf/Integration_hooks#Registration.2C_and_other_user_hooks should help you achieve that.

Arantor:
There are precisely two places that an avatar can ever be loaded, no more, no less. One is in Subs.php for the current user to show in the header, every other possible case of avatars is defined in Load.php, loadMemberData() and prepared for general use by loadMemberContext(). (I make no allowances for mods that do their own insanity.)

Defining the avatar on registration is doable but you're probably better off not doing it in profile code and instead merely disabling choice entirely if you're using a third party service instead.

Navigation

[0] Message Index

[#] Next page

Go to full version