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

Remove admin user from "staff online now" sidebar

Discussion in 'XenForo Questions and Support' started by Geoffrey, Sep 8, 2012.

  1. Geoffrey

    Geoffrey Active Member

    Forgive me if this in the wrong place, not really sure what this will involve so I'm not sure what section this goes in.

    Anyways, I've got a couple users that I've given admin rights (both to the styles/templates section ONLY) and they have no staff power or authority on the forum. However, because I've made them admins, they show up in the staff online section but they aren't really staff, just style managers basically.

    Is there a way to hide those users from the staff online section (and only show them in the section for other members when online, because I don't want to hide their online status complete)? Let me know.

    Board link in sig if you need to see it to test or whatever. Thanks in advance!
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> sidebar_online_users

    Add the red code:

    Code:
    <!-- block: sidebar_online_staff -->
    <xen:if hascontent="true">
    	<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} AND {$user.user_id} != 5">
    							<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>
    					</xen:foreach>
    				</xen:contentcheck>
    			</ul>
    		</div>
    	</div>
    </xen:if>
    <!-- end block: sidebar_online_staff -->
    
    You need to specify the user_id.
     
  3. Geoffrey

    Geoffrey Active Member

    I don't know much about coding, but that looks like it would ADD a user to the staff online section. I want to remove 2 users from it, only showing them in the members online. Also, to add multiple user IDs, do I repeat the whole line, add a comma then the number, or what?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Code:
    <!-- block: sidebar_online_staff -->
    <xen:if hascontent="true">
    	<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} AND !in_array({$user.user_id}, array(5,6,7))">
    							<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>
    					</xen:foreach>
    				</xen:contentcheck>
    			</ul>
    		</div>
    	</div>
    </xen:if>
    <!-- end block: sidebar_online_staff -->
    
     
    ArnyVee likes this.
  5. Geoffrey

    Geoffrey Active Member

    Thanks. :)
     
  6. tictocchoc

    tictocchoc Member

    To remove completely the 'Online Users', would you just comment the whole sidebar_online_users code?
     
  7. James

    James Well-Known Member

    Sure, or remove the template include in forum_list.
     
    tictocchoc likes this.
  8. tictocchoc

    tictocchoc Member

    In forum_list:

    changing this:
    Code:
    <xen:sidebar>
        <xen:edithint template="sidebar.css" />
     
        <xen:hook name="forum_list_sidebar">
            <xen:include template="sidebar_online_users" />
     
            <!-- block: forum_stats -->
    in:
    Code:
    <xen:sidebar>
        <xen:edithint template="sidebar.css" />
     
        <xen:hook name="forum_list_sidebar">
            <xen:comment><xen:include template="sidebar_online_users" /></xen:comment>
     
            <!-- block: forum_stats -->
    do the trick!

    Thanks James.
     
    James likes this.
  9. erich37

    erich37 Well-Known Member

    how do I remove the "Staff Online" in the sidebar for guests?

    I do not want my "Guests" to see any Admin or Moderator in the sidebar at "Staff Online".


    Appreciate your help!

    :)
     
  10. Brogan

    Brogan XenForo Moderator Staff Member

  11. erich37

    erich37 Well-Known Member

    Thanks, I managed it by changing the template "sidebar_online_users" from default code:

    Code:
    <!-- block: sidebar_online_staff -->
    <xen:if hascontent="true">
        <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="userTitle">{xen:helper userTitle, $user}</div>
                                </li>
                            </xen:if>
                        </xen:foreach>
                    </xen:contentcheck>
                </ul>
            </div>
        </div>
    </xen:if>
    <!-- end block: sidebar_online_staff -->
    

    and changing it to this custom code:
    Code:
    <!-- block: sidebar_online_staff -->
    <xen:if is="{$visitor.user_id}">
     
    <xen:if hascontent="true">
        <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="userTitle">{xen:helper userTitle, $user}</div>
                                </li>
                            </xen:if>
                        </xen:foreach>
                    </xen:contentcheck>
                </ul>
            </div>
        </div>
    </xen:if>
     
    </xen:if>
    <!-- end block: sidebar_online_staff -->
    

    :)
     

Share This Page