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

XF 1.3 Change avatar variable's html ?

eva2000

Well-known member
#1
I want to add an onload event to the img tag for the avatars in recent threads and search results but searching the templates all I find is this
Code:
<xen:avatar user="$thread" size="s" img="true" />
so where do I go to edit the html itself ?
Code:
<img src="data/avatars/s/0/1.jpg?1400874594" width="48" height="48" onload="XXX">
thanks :)
 

Chris D

XenForo developer
Staff member
#4
Check out the file:

library/XenForo/Template/Helper/Core.php

Look for: helperAvatarHtml

There are two ways of displaying avatars.

Img mode:
PHP:
$image = "<img src=\"{$src}\" width=\"{$dimension}\" height=\"{$dimension}\" alt=\"{$username}\" />";
And background mode:
PHP:
$image = "<span class=\"img {$size}\" style=\"background-image: url('{$src}')\">{$text}</span>";
It's not easily possible to extend that code, though it is possible to override it completely but that would affect other add-ons.