Necrophyte
08-15-2016, 10:51 PM
I want to be able to change the avatar icon in the forum list to the rank icon.
However for the life of me I can't figure out the template properly to make this work.
I've tracked it down to 'display_Forums_item' template on these lines.
<vb:if condition="$user['showavatars']">
<vb:if condition="$forum['lastcontent']['userid'] > 0">
<vb:comment>avatar info must be fetched in batches in the parent template</vb:comment>
<a href="{vb:url 'profile', {vb:raw forum.lastcontent}}" class="avatar h-left">
<img src="{vb:raw baseurl_corecdn}/{vb:raw avatar[$forum['lastcontent']['userid']]['avatarpath']}" width="32" height="32" alt="{vb:raw forum.lastcontent.authorname}" />
</a>
<vb:else />
<span class="avatar h-left">
<img src="{vb:raw baseurl_corecdn}/images/default/default_avatar_thumb.png" width="32" height="32" alt="{vb:phrase guest_avatar}" />
</span>
</vb:if>
</vb:if>
</vb:if>
How can I pass that rank_icon to the template so I can use it?
--------------- Added 1471379667 at 1471379667 ---------------
Ok, figured this out. There is the template variables
https://www.vbulletin.com/docs/html/main/dev_vbulletin5_template_syntax
Also learned that if you want you can debug the variables inside templates as well. Can give you the entire list of them, or just what you need.
After writing my own api function I was able to pull the data I needed using the vb:data function in the templates.
However for the life of me I can't figure out the template properly to make this work.
I've tracked it down to 'display_Forums_item' template on these lines.
<vb:if condition="$user['showavatars']">
<vb:if condition="$forum['lastcontent']['userid'] > 0">
<vb:comment>avatar info must be fetched in batches in the parent template</vb:comment>
<a href="{vb:url 'profile', {vb:raw forum.lastcontent}}" class="avatar h-left">
<img src="{vb:raw baseurl_corecdn}/{vb:raw avatar[$forum['lastcontent']['userid']]['avatarpath']}" width="32" height="32" alt="{vb:raw forum.lastcontent.authorname}" />
</a>
<vb:else />
<span class="avatar h-left">
<img src="{vb:raw baseurl_corecdn}/images/default/default_avatar_thumb.png" width="32" height="32" alt="{vb:phrase guest_avatar}" />
</span>
</vb:if>
</vb:if>
</vb:if>
How can I pass that rank_icon to the template so I can use it?
--------------- Added 1471379667 at 1471379667 ---------------
Ok, figured this out. There is the template variables
https://www.vbulletin.com/docs/html/main/dev_vbulletin5_template_syntax
Also learned that if you want you can debug the variables inside templates as well. Can give you the entire list of them, or just what you need.
After writing my own api function I was able to pull the data I needed using the vb:data function in the templates.