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

Disable Members Online Now

Discussion in 'Styling and Customization Questions' started by shakuni, Apr 26, 2013.

  1. shakuni

    shakuni New Member

    Hi, how can I delete the 'Members Online Now' box from the sidebar completely? Thanks for the help!
     
  2. Shelley

    Shelley Well-Known Member

    I'm quite sure there isn't an option to disable it. You can throw the following in EXTRA.CSS and hide it.

    Code:
    .sidebar .membersOnline {display: none;}
     
  3. shakuni

    shakuni New Member

    Hi Shelley, Thanks a lot for quick reply. But I am not a big fan of display:none. Google doesn't like it much and the code is still being executed. I need to remove the code from sidebar.
     
  4. Shelley

    Shelley Well-Known Member

    I'm quite sure then you want to be looking in the sidebar_online_users template

    Code:
    <!-- 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="listInline">
                    <xen:foreach loop="$onlineUsers.records" value="$user" i="$i">
                        <xen:if is="{$i} <= {$onlineUsers.limit}">
                            <li>
                            <xen:if is="{$user.user_id}">
                                <a href="{xen:link members, $user}"
                                    class="username{xen:if '!{$user.visible}', ' invisible'}{xen:if {$user.followed}, ' followed'}">{xen:helper richUserName, $user}</a><xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
                            <xen:else />
                                {xen:phrase guest}<xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
                            </xen:if>
                            </li>
                        </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 -->
     
  5. shakuni

    shakuni New Member

    Hi Shelley, Thanks for quick update. Can you tell me which file handles the whole sidebar? I will then go into it and remove the call to sidebar_online_users template. Hope that will work?
     
  6. Shelley

    Shelley Well-Known Member

    I'm not sure. Perhaps Brogan or one of the advance devs can jump in and answer this for you. Sorry.
     
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    The call is in the template forum_list, specifically:
    HTML:
    <xen:include template="sidebar_online_users" />
     
  8. shakuni

    shakuni New Member

    ok great, so deleting it will solve my problem?
     
  9. Jeremy

    Jeremy XenForo Moderator Staff Member

    Yes. It won't include the template.
     
  10. shakuni

    shakuni New Member

    ok great, Thanks!
     
  11. TeflonDon

    TeflonDon Well-Known Member

    Is there a way to only display this:

    Members Online Now
    Online now: 600 (members: 500, guests: 100)

    without displaying 50 usernames followed by ".... and 450 more" ?
     
  12. Brogan

    Brogan XenForo Moderator Staff Member

    The ACP option doesn't allow it to be disabled completely so you would have to edit the template.

    Alternatively you can try adding to EXTRA.css: .listInline { display:none; }
     
  13. TeflonDon

    TeflonDon Well-Known Member

    Got it, thanks for the quick reply.
     
  14. semprot

    semprot Active Member

    If the template is removed from being called, does the database process to get online users is not called too?
     
  15. AndyB

    AndyB Well-Known Member

    Yes.
     
    semprot likes this.
  16. semprot

    semprot Active Member

    Awesome :)
     
  17. Jeremy

    Jeremy XenForo Moderator Staff Member

    That is incorrect. The database call will still be made.
     
    semprot likes this.
  18. semprot

    semprot Active Member

    Any idea how to disable the db call? Because my forum has > 1000 online logged in users, and online list is not necessary on my forum, any idea how to disable the db call? :)
     
  19. Jeremy

    Jeremy XenForo Moderator Staff Member

    You would have to edit files on every single upgrade.
     
    semprot likes this.
  20. AndyB

    AndyB Well-Known Member

    You can do this to save running the code.

    library/XenForo/Model/Session.php

    line 55

    PHP:
      public function getSessionActivityQuickList(array $viewingUser, array $conditions = array(), array $forceInclude null)
       { 

        
    // start hack
        
    return;
        
    // end hack

         
    $fetchOptions = array(
           
    'join' => self::FETCH_USER,
           
    'order' => 'username'
         
    );
    It's possible to create an add-on to do the above so you won't have to edit the core code every time you upgrade.
     
    semprot likes this.

Share This Page