Firefox PHP

Avatar module - ok in read.tpl but not in list.tpl

Posted by elmotard 
Avatar module - ok in read.tpl but not in list.tpl
May 11, 2020 11:00PM
Hello,

I have the user_avatar modules and it is working fine as long as i want to display the avatar in the read.tpl template : meaning, i have the correct avatar displayed.

But if i put the same code ({MESSAGES->user_avatar}) in the list.tpl, then i get only the avatar of the last user that respond that last message.

How to get the avatar of the person who did create the post in list.tpl ? I have tried {MESSAGE->user_avatar} but it is broken, meaning not giving anything.

Thank you

Regards



Edited 1 time(s). Last edit at 05/11/2020 11:10PM by elmotard.
Re: Avatar module - ok in read.tpl but not in list.tpl
May 12, 2020 01:31AM
The only solution I found is to call the api directly within the list.tpl.
It is working but i'm not sure it is the most efficient way.

Here what is did :
getting user_id of the first message, and the looking for the avatar, if it is >0 then i display it after, all within <?php tags
$userdata = phorum_api_user_get($PHORUM['TMP']['MESSAGES']['user_id'],true);
$profile=$userdata['mod_user_avatar']['avatar'];

Your thoughts ?
Sorry, only registered users may post in this forum.

Click here to login