• 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

Geoffrey

Active member
#1
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!
 

Jake Bunce

XenForo moderator
Staff member
#2
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.
 

Geoffrey

Active member
#3
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?
 

Jake Bunce

XenForo moderator
Staff member
#4
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 -->
 
#8
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.
 

erich37

Well-known member
#9
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!

:)
 

erich37

Well-known member
#11
Use the guest conditional in the template.

The very first one here: http://xenforo.com/community/resources/conditional-statements.1604/
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 -->

:)