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

XF 1.4 Prevent certain user group from appearing in members online

Discussion in 'XenForo Questions and Support' started by ALMUSA, Aug 15, 2015.

  1. ALMUSA

    ALMUSA Member

    Hi folks,

    Is there a way to exclude certain user group from the members online now?
     
  2. James

    James Well-Known Member

    You can modify the template and add an exclusion for the user group ids of the users you don't want to appear.

    Can't give you exact code as I'm mobile but the template will be the sidebar_online_users.
     
  3. ALMUSA

    ALMUSA Member

    Thanks a bunch mate. Can you provide me with the necessary code please.
     
  4. James

    James Well-Known Member

    Code:
    <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} AND !{xen:helper ismemberof, $user, x, y, z }">
                                <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>
                            </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>
    See the red bit.

    Where x, y, z are the user group ids. Omit any not necessary.
     
    ALMUSA likes this.
  5. ALMUSA

    ALMUSA Member

    User group Id number is 7. I put that where the x is but still visible. Any idea?
    Code:
    
    <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} AND !{xen:helper ismemberof, $user, 7 }">
                                <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>
                            </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>
     
    Last edited: Aug 23, 2015
  6. James

    James Well-Known Member

    Is that the user's ID or the ID of the user group?
     
  7. ALMUSA

    ALMUSA Member

    User group ID
     

Share This Page