XenForo Tutorials

Animated Avatars in threads

Submitted by security, , Thread ID: 8237

Thread Closed
28-07-2015, 08:43 AM
This post was last modified: 28-07-2015, 08:44 AM by security
#1
This is a simple template edit that allows animated avatars to show in posts. You have two options here:

1. Forces the size of all avatars to be 96x96
2. Allow avatars to use their aspect ration.

Also there is 2 versions, one that displays the animation to everyone and the other codes won't show animation to guests for faster browsing. [Image: clear.png]

Guest will see animation


Forced 96x96 edit: Open template message_user_info

Find
Code:
<xen:avatar user="$user" size="m" />
Replace with
Code:
<a class="username avatar Av{$user.user_id}l" href="{xen:link members, $user}">
<img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" height="96px" width="96px" itemprop="photo" />
</a>
Aspect ration edit: Open template message_user_info

Find
Code:
<xen:avatar user="$user" size="m" />
Replace with
Code:
<a class="username avatar Av{$user.user_id}l" href="{xen:link members, $user}">
<img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" style="max-height:96px;max-width:96px;" itemprop="photo" />
</a>
If guest; do not display animation

Forced 96x96 edit: Open template message_user_info

Find
Code:
<xen:avatar user="$user" size="m" />
Replace with
Code:
<xen:if is="!{$visitor.user_id}">
<xen:avatar user="$user" size="m" />
<xen:else />
<a class="username avatar Av{$user.user_id}l" href="{xen:link members, $user}">
<img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" height="96px" width="96px" itemprop="photo" />
</a></xen:if>
Aspect ration edit: Open template message_user_info

Find
Code:
<xen:avatar user="$user" size="m" />
Replace with
Code:
<xen:if is="!{$visitor.user_id}">
<xen:avatar user="$user" size="m" />
<xen:else />
<a class="username avatar Av{$user.user_id}l" href="{xen:link members, $user}">
<img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" style="max-height:96px;max-width:96px;" itemprop="photo" />
</a></xen:if>

Users browsing this thread: 4 Guest(s)