XF 2.1 Conditional to display larger avatar for certain user groups

sandnes

Member
I'm trying to get this code to work, I'd like my postbit to show a larger avatar if the poster is a member of one of a list of possible user groups.
This is my code now, inserted into message_macros (where the avatar size line is located)... it doesn't break anything but it also doesn't work.
I changed this
Code:
                <xf:avatar user="$user" size="m" defaultname="{$fallbackName}" itemprop="image" />
to this:
Code:
            <xf:if is="in_array({$post.User.isMemberOf}, [3,5,12,17,19,20,31,32,33])">
                <xf:avatar user="$user" size="l" defaultname="{$fallbackName}" itemprop="image" />
            <xf:else />
                <xf:avatar user="$user" size="m" defaultname="{$fallbackName}" itemprop="image" />
            </xf:if>
I'm totally guessing on the syntax and am probably guessing wrong. Can anyone suggest changes?
 
This appears to have worked for me (but if anyone has comments, please comment!):
Code:
            <xf:if is="in_array({$user.user_group_id}, [3,5,12,17,19,20,31,32,33])">
                <xf:avatar user="$user" size="l" defaultname="{$fallbackName}" itemprop="image" />
            <xf:else />
                <xf:avatar user="$user" size="m" defaultname="{$fallbackName}" itemprop="image" />
            </xf:if>
 
Back
Top Bottom