• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

alternate sidebar: members online now

dieketzer

Well-known member
this sidebar will load avatars for your online members rather than the default text link. i thought the members would like being able to see at a glance whos online, rather than see a list of text. member feedback has been positive.

what makes this sidebar different than the other available avatar sidebars is the following:
  • the smallest avatars are loaded.
  • admins and moderators will not reappear in 'members' (they already show in 'staff online').
  • people you follow will not reappear in 'members' (they already show in 'people you follow').
  • tooltip on mouseover with the members name.
  • 'invisible' members' show to admin/mods as semi-transperent
those worried about this bloating out the page:
  • the avs are an average of 5KiB in size.
  • the avs are cached by your regulars.
  • the number of avs listed is configurable via the acp.
online2.webp
(1.01) in template sidebar_online_users:

replace all code with:
Code:
<xen:edithint template="sidebar.css" />

<xen:if hascontent="true">
    <!-- block: sidebar_online_staff -->
    <div class="section staffOnline avatarList">
        <div class="secondaryContent">
            <h3>{xen:phrase staff_online_now}</h3>
            <ul>
                <xen:contentcheck>
                    <xen:foreach loop="$onlineUsers.records" value="$user">
                        <xen:if is="{$user.is_moderator} OR {$user.is_admin}">
                            <li>
                                <xen:avatar user="$user" size="s" img="true" class="{xen:if '!{$user.visible}', 'dKinvisible'}" />
                                <xen:username user="$user" rich="true" />
                                <div class="userTitle">{xen:helper userTitle, $user}</div>
                            </li>
                        </xen:if>
                    </xen:foreach>
                </xen:contentcheck>
            </ul>
        </div>
    </div>
    <!-- end block: sidebar_online_staff -->
</xen:if>

<!-- block: sidebar_online_users -->
<div class="section membersOnline userList">
    <div class="secondaryContent">
        <h3><a href="{xen:link online}" title="{xen:phrase see_all_online_users}">{xen:phrase members_online_now}</a></h3>
        <xen:if is="{$onlineUsers.records}">
            <xen:if is="{$visitor.user_id}">
                <xen:if hascontent="true">
                <h4 class="minorHeading"><a href="{xen:link account/following}">{xen:phrase people_you_follow}:</a></h4>
                <ul class="followedOnline">
                    <xen:contentcheck>
                        <xen:foreach loop="$onlineUsers.records" value="$user">
                            <xen:if is="{$user.followed}">
                                <li title="{$user.username}" class="Tooltip"><xen:avatar user="$user" size="s" img="true" class="_plainImage{xen:if '!{$user.visible}', ' dKinvisible'}" /></li>
                            </xen:if>
                        </xen:foreach>
                    </xen:contentcheck>
                </ul>
                <h4 class="minorHeading"><a href="{xen:link members}">{xen:phrase members}:</a></h4>
                </xen:if>
            </xen:if>

            <ol class="followedOnline">
                <xen:foreach loop="$onlineUsers.records" value="$user" i="$i">
                    <xen:if is="{$i} <= {$onlineUsers.limit}">

                  <xen:if is="!{$user.followed} && !{$user.is_moderator} && !{$user.is_admin}">
                            <xen:if is="{$user.user_id}">
                  <li title="{$user.username}" class="Tooltip"><xen:avatar user="$user" size="s" img="true" class="_plainImage{xen:if '!{$user.visible}', ' dKinvisible'}" /></li>
                <xen:else />
                                {xen:phrase guest}<xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
                            </xen:if>
              </xen:if>

                    </xen:if>
                </xen:foreach>
                <xen:if is="{$onlineUsers.recordsUnseen}">
                    <li class="moreLink">... <a href="{xen:link online}" title="{xen:phrase see_all_visitors}">{xen:phrase and_x_more, 'count={xen:number $onlineUsers.recordsUnseen}'}</a></li>
                </xen:if>
            </ol>
        </xen:if>

        <div class="footnote">
            {xen:phrase online_now_x_members_y_guests_z, 'total={xen:number $onlineUsers.total}', 'members={xen:number $onlineUsers.members}', 'guests={xen:number $onlineUsers.guests}'}
        </div>
    </div>
</div>
<!-- end block: sidebar_online_users -->

the semi-transparent state of invisible members is set by .dKinvisible. you can change this css to suit your own purposes.
add to template EXTRA.css
Code:
/* alternate members online */
.dKinvisible
{
        opacity:0.6;
}

changelog:
1.may.11
-fixed an issue that caused some staff members to appear twice
-invisible users now display admins/mods a semi-transparent avatar
 
if you are using jaxels portal you will want to also edit his module template.
note: newer portal releases do not require a template change.

if you are using xfrocks' widget framework you will want to edit his widget templates:

in template wf_widget_online_users:
replace the entire template with:
Code:
        <xen:if is="{$onlineUsers.records}">
            <xen:if is="{$visitor.user_id}">
                <xen:if hascontent="true">
                <h4 class="minorHeading"><a href="{xen:link account/following}">{xen:phrase people_you_follow}:</a></h4>
                <ul class="followedOnline">
                    <xen:contentcheck>
                        <xen:foreach loop="$onlineUsers.records" value="$user">
                            <xen:if is="{$user.followed}">
                                <li title="{$user.username}" class="Tooltip"><xen:avatar user="$user" size="s" img="true" class="_plainImage" /></li>
                            </xen:if>
                        </xen:foreach>
                    </xen:contentcheck>
                </ul>
                <h4 class="minorHeading"><a href="{xen:link members}">{xen:phrase members}:</a></h4>
                </xen:if>
            </xen:if>

            <ol class="followedOnline">
                <xen:foreach loop="$onlineUsers.records" value="$user" i="$i">
                    <xen:if is="{$i} <= {$onlineUsers.limit}">

                  <xen:if is="!{$user.followed} && !{$user.is_moderator} && !{$user.is_admin}">
                            <xen:if is="{$user.user_id}">
                  <li title="{$user.username}" class="Tooltip"><xen:avatar user="$user" size="s" img="true" class="_plainImage{xen:if '!{$user.visible}', ' dKinvisible'}" /></li>
                <xen:else />
                                {xen:phrase guest}<xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
                            </xen:if>
              </xen:if>

                    </xen:if>
                </xen:foreach>
                <xen:if is="{$onlineUsers.recordsUnseen}">
                    <li class="moreLink">... <a href="{xen:link online}" title="{xen:phrase see_all_visitors}">{xen:phrase and_x_more, 'count={xen:number $onlineUsers.recordsUnseen}'}</a></li>
                </xen:if>
            </ol>
        </xen:if>

        <div class="footnote">
            <a href="{xen:link online}" title="{xen:phrase see_all_online_users}">{xen:phrase online_now_x_members_y_guests_z, 'total={xen:number $onlineUsers.total}', 'members={xen:number $onlineUsers.members}', 'guests={xen:number $onlineUsers.guests}'}</a>
        </div>

in template wf_widget_online_staff:

replace the entire template with:
Code:
<xen:if hascontent="true">

<div class="avatarList">

    <ul>

        <xen:contentcheck>

            <xen:foreach loop="$onlineUsers.records" value="$user">

                <xen:if is="{$user.is_moderator} OR {$user.is_admin}">

                    <li>

                        <xen:avatar user="$user" size="s" img="true" class="{xen:if '!{$user.visible}', ' dKinvisible'}" />

                        <xen:username user="$user" rich="true" />

                        <div class="userTitle">{xen:helper userTitle, $user}</div>

                    </li>

                </xen:if>

            </xen:foreach>

        </xen:contentcheck>

    </ul>

</div>

</xen:if>
 
Hi Mate

Great mod, I REALLY want to use this. I replaced all code in template online_sidebar_users with all the code in your first post. I dont get any errors but nothing changes, just lists usernames as text as per normal. I am running beta 5 with original template, any ideas? cheers
 
Hi Mate

Great mod, I REALLY want to use this. I replaced all code in template online_sidebar_users with all the code in your first post. I dont get any errors but nothing changes, just lists usernames as text as per normal. I am running beta 5 with original template, any ideas? cheers
the code in the first post is for template sidebar_online_users (forum side block)
the code in the second post is for template EWRporta_Block_OnlineUsers (portal side block)
they are not interchangeable
 
the code in the first post is for template sidebar_online_users (forum side block)
the code in the second post is for template EWRporta_Block_OnlineUsers (portal side block)
they are not interchangeable

Yep I did exactly as your first post states. I also use the portal but I havent even tried the portal code yet as I cant get the mod to work in the sidebar. I went in my ACP, went to templates. Opened up sidebar_online_users template, removed all the code from there and replaced it with the code in your first post, this is correct yeh? It didnt work for me
 
If you would like to see for yourself my site is www.mmazone.com.au

currently my template has your code in it but as you can see its not showing pictures, just text as usual.
this suggests you may have edited a template that is not being used in your active theme. it is not possible for the text usernames to be appearing because all the template code for that has been removed.
 
this suggests you may have edited a template that is not being used in your active theme. it is not possible for the text usernames to be appearing because all the template code for that has been removed.

Thats a little strange considering im using the default template isnt it? I havent made too many mods, most are through XML files, i barley edited any templates and if i did its usually one liners. I dont recall editing this template in particular so I dont know whats going on?? But 100% as of now the template is showing your code in the first page... not sure what else I can do? I really want to use this cool mod
 
Im an idiot! I didnt realise that using my admin account i would only see me in the staff online! Sorry long night, thanks mate
 
how does this handle invisible users for staff? right now admins can see invisible users faded out. are the avs faded? just curious
 
how does this handle invisible users for staff? right now admins can see invisible users faded out. are the avs faded? just curious
one caveat of using the avatars rather than the default text is that invisible users will not give any hint that they are invisible. their avatars will show to the admin as 'visible'. so be careful!
i plan to redo this once xf goes gold. i will load invisibles' avatars at 60% opacity or whatnot.
 
Ok I replaced the code on my RC3 install and the online users shows nothing at all now, not even a text link. I have reverted the changes.

Any ideas?
 
My template sidebar_online_users

PHP:
<xen:edithint template="sidebar.css" />

<xen:if hascontent="true">
 <!-- block: sidebar_online_staff -->
 <div class="section staffOnline avatarList">
 <div class="secondaryContent">
 <h3>{xen:phrase staff_online_now}</h3>
 <ul>
 <xen:contentcheck>
 <xen:foreach loop="$onlineUsers.records" value="$user">
 <xen:if is="{$user.is_moderator} OR {$user.is_admin}">
 <li>
 <xen:avatar user="$user" size="s" img="true" />
 <xen:username user="$user" rich="true" />
 <div class="userrank_lms">{xen:helper userTitle, $user}</div>
 </li>
 </xen:if>
 </xen:foreach>
 </xen:contentcheck>
 </ul>
 </div>
 </div>
 <!-- end block: sidebar_online_staff -->
</xen:if>

<!-- block: sidebar_online_users -->
<div class="section membersOnline userList">
 <div class="secondaryContent">
 <h3><a href="{xen:link online}" title="{xen:phrase see_all_online_users}">{xen:phrase members_online_now}</a></h3>
 <xen:if is="{$onlineUsers.records}">
 <xen:if is="{$visitor.user_id}">
 <xen:if hascontent="true">
 <h4 class="minorHeading"><a href="{xen:link account/following}">{xen:phrase people_you_follow}:</a></h4>
 <ul class="followedOnline">
 <xen:contentcheck>
 <xen:foreach loop="$onlineUsers.records" value="$user">
 <xen:if is="{$user.followed}">
 <li title="{$user.username}" class="Tooltip"><xen:avatar user="$user" size="s" img="true" class="_plainImage" /></li>
 </xen:if>
 </xen:foreach>
 </xen:contentcheck>
 </ul>
 <h4 class="minorHeading"><a href="{xen:link members}">{xen:phrase members}:</a></h4>
 </xen:if>
 </xen:if>

 <ol class="followedOnline">
 <xen:foreach loop="$onlineUsers.records" value="$user" i="$i">
 <xen:if is="{$i} <= {$onlineUsers.limit}">
 <xen:if is="!{$user.is_moderator} OR !{$user.is_admin}">
 <xen:if is="!{$user.followed}">
 <xen:if is="{$user.user_id}">
 <li title="{$user.username}" class="Tooltip"><xen:avatar user="$user" size="s" img="true" class="_plainImage" /></li>
 <xen:else />
 {xen:phrase guest}<xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
 </xen:if>
 </xen:if>
 </xen:if>
 </xen:if>
 </xen:foreach>
 <xen:if is="{$onlineUsers.recordsUnseen}">
 <li class="moreLink">... <a href="{xen:link online}" title="{xen:phrase see_all_visitors}">{xen:phrase and_x_more, 'count={xen:number $onlineUsers.recordsUnseen}'}</a></li>
 </xen:if>
 </ol>
 </xen:if>

 <div class="footnote">
 {xen:phrase online_now_x_members_y_guests_z, 'total={xen:number $onlineUsers.total}', 'members={xen:number $onlineUsers.members}', 'guests={xen:number $onlineUsers.guests}'}
 </div>
 </div>
</div>
<!-- end block: sidebar_online_users -->
Looks like


1.webp


Salud2​
 
Ok I replaced the code on my RC3 install and the online users shows nothing at all now, not even a text link. I have reverted the changes.

Any ideas?
i am guessing you are having the same issue ddmmh had. he was looking at a blank members online thinking it was a problem without taking into account there were no members other than himself online. remember, the admin account already shows in 'staff online', so you will not show in members online as well. log in with an alt account and you will see your icon in members online.
 
Top Bottom