XF 2.0 How can I create a separate Staff online widget?

Gator

Well-known member
I clipped this code from the actual widget, but I can't get it to display the Staff names.

Code:
<xf:if is="$options.staffOnline">
    <xf:if contentcheck="true">
        <div class="block" data-widget-section="staffMembers"{{ widget_data($widget) }}>
            <div class="block-container">
                <h3 class="block-minorHeader"><a href="{{ link('members', null, {'key': 'staff_members'}) }}">{{ phrase('staff_online') }}</a></h3>
                <ul class="block-body">
                <xf:contentcheck>
                    <xf:foreach loop="$online.users" value="$user">
                        <xf:if is="$user.is_staff">
                            <li class="block-row">
                                <div class="contentRow">
                                    <div class="contentRow-figure">
                                        <xf:avatar user="$user" size="xs" />
                                    </div>
                                    <div class="contentRow-main contentRow-main--close">
                                        <xf:username user="$user" rich="true" />
                                        <div class="contentRow-minor">
                                            <xf:usertitle user="$user" />
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </xf:if>
                    </xf:foreach>
                </xf:contentcheck>
                </ul>
            </div>
        </div>
    </xf:if>
</xf:if>
 
That's probably not going to work directly since the data isn't being loaded if you just copy the markup, you'd probably need to use the full user online widget and hide the members online portion using CSS by targeting the widget definition ID
 
That's probably not going to work directly since the data isn't being loaded if you just copy the markup, you'd probably need to use the full user online widget and hide the members online portion using CSS by targeting the widget definition ID
Thanks for your response, Jake, but that's beyond my skill set. :)
 
Last edited:
Rich (BB code):
.block[data-widget-section='yourIdHere'] .block-row:last-child { display: none !important }

Just replace yourIdHere with whatever ID you set when adding the widget, if you wanted to hide it on the default XF widget you'd do:

Code:
.block[data-widget-section='onlineNow'] .block-row:last-child { display: none !important; }
 
Top Bottom