Page 1 of 1

event memberlist_team_username_prepend

Posted: Thu Aug 15, 2019 7:53 pm
by ad0726
Hello !

I use core.memberlist_team_modify_query and core.memberlist_team_modify_template_vars to add avatar of each user of memberlist_team. And it works.
When I put {group.user.AVATAR_IMG} on line 22 from memberlis_team.html, for the debug, I have the right data.

Code: Select all

<td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF --><!-- EVENT memberlist_team_username_prepend -->{group.user.AVATAR_IMG}{group.user.USERNAME_FULL}<!-- IF group.user.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --><!-- EVENT memberlist_team_username_append --></td>
But when I put the same thing into memberlist_team_username_prepend.html, it doesn't work.
In this file, group.user contains group data. So, in this file, {group.user[0].AVATAR_IMG}, {group.user[1].AVATAR_IMG}... that works...

Re: event memberlist_team_username_prepend

Posted: Thu Aug 15, 2019 9:38 pm
by 3Di
Please show the whole extension, preferred as its GitHub repo, we will see what's wrong.

Hopefully. :)

Re: event memberlist_team_username_prepend

Posted: Fri Aug 16, 2019 8:24 am
by ad0726
Finaly, I succeeded but I don't understand it's like this ^^

This is the GitHub https://github.com/ad0726/memberlistavatar

The solution is to use user.AVATAR_IMG (here). However, in memberlist_team.html where there is memberlist_team_username_prepend, it's group.user.USERNAME_FULL (for exemple) (here).

I push "AVATAR_IMG" into template_vars and this is pushed into group.user (here).

So, why does user.AVATAR_IMG work with memberlist_team_username_prepend instead of group.user.AVATAR_IMG?

Re: event memberlist_team_username_prepend

Posted: Fri Aug 16, 2019 6:24 pm
by canonknipser
Because in the teampage you have two hierarchy levels: first the groups like admin, global moderators and any other group which has the attribute "Show on team page". The second is the member in the group. As a member can be in several groups, you need both levels two identify a member in its correct place - eg. on memberlist.php?mode=team "JimA" is in at least two teams

Re: event memberlist_team_username_prepend

Posted: Fri Aug 16, 2019 7:00 pm
by ad0726
This explains group.user.value in memberlist_team.html, but no why it doesn't work with memberlist_team_username_prepend. However, this event is just before group.user.USERNAME_FULL.