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

Where to block members/guests count

Discussion in 'XenForo Questions and Support' started by justwordme, Dec 11, 2011.

  1. justwordme

    justwordme Active Member

    Easy, easy question where do I insert the "if admin code from the FAQ" to prevent users seeing how many others are online "as my board is just ramping up and don't want to advertise how few are online)

    Members Online.png

    I'm thinking this is the correct code to insert to just show to admins and Mods only?
    <xen:if is="{$visitor.is_admin} OR {$visitor.is_moderator}">
    This content will show to Administrators and Moderators
  2. Brogan

    Brogan XenForo Moderator Staff Member

    The sidebar_online_users template.
  3. justwordme

    justwordme Active Member

    Thanks but that's where I get lost been looking around and posting string for the past hour. Still cannot figure out right spot.
  4. Brogan

    Brogan XenForo Moderator Staff Member

    <!-- 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: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>
                    <h4 class="minorHeading"><a href="{xen:link members}">{xen:phrase members}:</a></h4>
                <ol class="listInline">
                    <xen:foreach loop="$onlineUsers.records" value="$user" i="$i">
                        <xen:if is="{$i} <= {$onlineUsers.limit}">
                            <xen:if is="{$user.user_id}">
                                <a href="{xen:link members, $user}"
                                    class="username{xen:if '!{$user.visible}', ' invisible'}{xen:if {$user.followed}, ' followed'}">{$user.username}</a><xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
                            <xen:else />
                                {xen:phrase guest}<xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
                    <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>
            <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}'}
    <!-- end block: sidebar_online_users -->
  5. justwordme

    justwordme Active Member

    Brogan your such a genius with the programming. Someday I hope to know half as much as you. I've only been working with coding for the past few weeks. I found the block hours ago. I inserted the code above and just about every spot I can think to no avail thus the questions. I even got it to say "admin only etc" but it still shows to every unregistered Guest. I even tried the coding for registered user only.

    lol.... it not show when I delete but that's not what I wanting.

Share This Page