• 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 ?


Well-known member
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
<xen:avatar user="$thread" size="s" img="true" />
so where do I go to edit the html itself ?
<img src="data/avatars/s/0/1.jpg?1400874594" width="48" height="48" onload="XXX">
thanks :)

Chris D

XenForo developer
Staff member
Check out the file:


Look for: helperAvatarHtml

There are two ways of displaying avatars.

Img mode:
$image = "<img src=\"{$src}\" width=\"{$dimension}\" height=\"{$dimension}\" alt=\"{$username}\" />";
And background mode:
$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.