• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Conditional woes - Display specific user(s) in sidebar

Andrej

Well-known member
#1
I have the following code here (which is added to sidebar_online_users) template. What it should do is to display an user with user ID 3 regardless of his status (online/offline).

Code:
<!-- block: sidebar_special_users -->
    <div class="section staffOnline avatarList">
        <div class="secondaryContent">
            <h3>Sponsors</h3>
            <ul>
                        <xen:if is="{$user.user_id} == 3">
                            <li>
                                <xen:avatar user="$user" size="s" img="true" />
                                <xen:username user="$user" rich="true" />
                                <div class="userTitle">{xen:helper userTitle, $user}</div>
                            </li>
                        </xen:if>
            </ul>
        </div>
    </div>
<!-- end block: sidebar_special_users -->
For some reason, it is not working. I asume it is because I am using wrong conditional, but if I try <xen:if is="{$visitor.user_id} == 3"> it doesn't work either. I suppose there must be something I forgot, so any help is highly appreciated.
 

Brogan

XenForo moderator
Staff member
#2
Just hard code it into the template, for example:
HTML:
<a href="{xen:link 'members/member.3/'}" class="avatar Av1m" data-avatarhtml="true"><img src="data/avatars/m/0/3.jpg" width="96" height="96" alt="Member" /></a>
That code is something I use on my site, so just adapt it to suit your requirments.
 

Andrej

Well-known member
#3
Thanks Brogan. I want it to display like the "Staff Online Now" block so I will experiment with the code you have providen. :)
 

Jeremy

Well-known member
#7
how to display username (user ID 3).
See:
Just hard code it into the template, for example:
HTML:
<a href="{xen:link 'members/member.3/'}" class="avatar Av1m" data-avatarhtml="true"><img src="data/avatars/m/0/3.jpg" width="96" height="96" alt="Member" /></a>
That code is something I use on my site, so just adapt it to suit your requirments.