• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 custom avatar management

#3
thanks Chris, but I need exactly the inverse thing: I wish that the user must not be able to select a personal avatar, 'cause is took by default from an url as shown above;
for simply the thing: suppose that you have a folder into a website with a .png file with the name equal to the id: for example in this forum: mine will be 3220.png, your 11388.png, and the avatar is exactly it ;)
 

Jake Bunce

XenForo moderator
Staff member
#4
All avatars on the forum call on this function:

XenForo_Template_Helper_Core::helperAvatarHtml

You could modify that function to suit your needs.

edit - in this file:

library/XenForo/Template/Helper/Core.php
 
#5
All avatars on the forum call on this function:

XenForo_Template_Helper_Core::helperAvatarHtml

You could modify that function to suit your needs.

edit - in this file:

library/XenForo/Template/Helper/Core.php
thanks Jake, so I need to modify brutally a file, no chance to build some plugin or similar ;)
 

feldon30

Well-known member
#10
Yeah I am trying to modify /library/XenForo/Template/Helper/Core.php to allow remotely-linked avatars. And before someone says "Why would you ever need remotely linked avatars?" I am dealing with a corporate client who does not want to allow uploads PERIOD.

I created a Custom User Profile Field named 'avatarurl'. That was the easy part.

So I tried to code the "right" way and use the helper function helperUserFieldValue() but after 1 hour of trying cannot get any variation on this to work:

$avatarurl = call_user_func(self::$helperCallbacks['userfieldvalue'], 'avatarurl', $user);

So then I resorted to $user['customFields']['avatarurl']. This works great, except for those few places where $user['customFields'] is not set and the best you can hope for is $user['custom_fields'] which is serialized data. I'd rather not have to try to unpack and parse a serialized string if I can help it.

P.S. I wouldn't know where to begin writing this as a Plugin. I figure I'll be lucky just to get this working as a code hack. :(