{xen:helper avatar, {xen:array 'user_id={$thread.lastPostInfo.user_id}', 'avatar_date=1'}, s}
Wow, that really helps, thanks! Maybe there is a way to check if avatar is set?The minimum amount of data you need to get an avatar is the user_id and avatar_date. The avatar_date is the field which confirms they have uploaded an avatar, but, of course, they might also have switched to using gravatar, in which case the gravatar field is important too.
That said, if you want to "fake it":
Code:{xen:helper avatar, {xen:array 'user_id={$thread.lastPostInfo.user_id}', 'avatar_date=1'}, s}
Only problem is if there's actually no avatar, then it will just show a broken image.
$(window).load(function() {
$('.avatar img').each(function() {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
// do whatever you want here, for example you can replace broken image with a default question mark avatar like this ↓
this.src = 'styles/default/xenforo/avatars/avatar_s.png';
}
});
});
We use essential cookies to make this site work, and optional cookies to enhance your experience.