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

Add-on URGENT Exclude usergroup/s from memberlist

Discussion in 'Resource and Add-on Requests' started by Morgain, Dec 17, 2012.

  1. Morgain

    Morgain Well-Known Member

    I urgently need to be able to exclude selected usergroups from the memberlist NOT relying on the Banned usergroup.

    These are functional but restricted members but their communication is only with admins not other members.
    They have View permissions generally (in some areas only) and permission to post in their own forum where admins respond to support.

    But I cannot set this up if they appear on the frontend memberlist.
    Please help.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    This is quite straight forward if you're happy doing a template edit?

    To confirm: You want to stop one or more usergroups from appearing in the member list?

    Template: member_list

    Find:

    Code:
    <ol class="section memberList">
    	<xen:foreach loop="$users" value="$user">
    		<xen:include template="member_list_item">
    			<xen:set var="$noOverlay">1</xen:set>
    		</xen:include>
    	</xen:foreach>
    </ol>
    Replace with:

    Code:
    <ol class="section memberList">
    	<xen:foreach loop="$users" value="$user">
    		<xen:if is="!{xen:helper ismemberof, $user, 3, 4}">
    			<xen:include template="member_list_item">
    				<xen:set var="$noOverlay">1</xen:set>
    			</xen:include>
    		</xen:if>
    	</xen:foreach>
    </ol>
    This means that if the member is a member of usergroup IDs 3 or 4, they will not appear in the list.

    You could, actually, also be a bit more advanced and say: If member is a member of usergroup IDs 3 or 4 they can see ONLY staff in the list :sneaky:
     
    sami simo likes this.
  3. Morgain

    Morgain Well-Known Member

    Chris I never thanked you for this. Exactly what I need
    Sorry no response. Have been very ill this week so head foggy.
     
  4. Morgain

    Morgain Well-Known Member

    I now want to put a list of staff on another page, displayed in memberlist style.

    I've gone over the snippet Chris gave me here and i can see it targets the selected usergroups in the added line
    but I don't understand how it commands NOT to display them
    so I don't know how to make it command ONLY the usergroups I want to display on this new page.
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    It commands NOT to display them via the ! operator.

    If is NOT member of usergroup 3 or 4:
    Code:
    <xen:if is="!{xen:helper ismemberof, $user, 3, 4}">
    If is member of usergroup 3 or 4:
    Code:
    <xen:if is="{xen:helper ismemberof, $user, 3, 4}">
     
    Morgain likes this.
  6. Morgain

    Morgain Well-Known Member

    Oh magic thank you Chris
     
  7. Morgain

    Morgain Well-Known Member

    Chris I tried adding it ust now to exclude and I'm getting an error

    Code:
    <ol class="section memberList">
    <xen:foreach loop="$users" value="$user">
    <xen:comment>SHAN EXCLUDE CONSULTS</xen:comment>
    <xen:if is="!{xen:helper ismemberof, $user, 24}">
    <xen:include template="member_list_item">
    <xen:set var="$noOverlay">1</xen:set>
    </xen:include>
    </xen:foreach>
    </xen:if>
    </ol>
     
  8. Morgain

    Morgain Well-Known Member

    I already have a control at the top to exclude unregistered could that be it?

    <!-- hide from unreg -->
    <xen:if is="{$visitor.user_id}">

    But I tried removing that and it made no difference.
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    What's the error? And where are you putting the code?
     
  10. Morgain

    Morgain Well-Known Member

    Er - I did it again to find the error and it worked beautifully.
    It's those mushrooms I had for supper because my name isn't Alice.
     
    Chris D likes this.
  11. bart

    bart Active Member

    I can't get this to work properly. It filters out the users, but it doesn't correct the total number of pages in the pagenav. It just shows less users per page.

    Is there an easy way to correct that?
     
  12. tyteen4a03

    tyteen4a03 Well-Known Member

    Will probably require an addon.
     
  13. sami simo

    sami simo Well-Known Member

    This was very helpful, I need to exclude the same usergroups from the notable memberlist now, the code above works only in the full memberlist. anyone knows how can I achieve this?
     
  14. Chris D

    Chris D XenForo Developer Staff Member

    Should be very similar to the notable members list.
     
    sami simo likes this.

Share This Page