• 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

Morgain

Well-known member
#1
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.
 

Chris D

XenForo developer
Staff member
#2
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:
 

Morgain

Well-known member
#3
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
CODE
This means that if the member is a member of usergroup IDs 3 or 4, they will not appear in the list.:sneaky:
Chris I never thanked you for this. Exactly what I need
Sorry no response. Have been very ill this week so head foggy.
 

Morgain

Well-known member
#4
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.
 

Chris D

XenForo developer
Staff member
#5
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

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

Morgain

Well-known member
#8
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.
 

bart

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

sami simo

Well-known member
#13
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?