MyBB Community Forums

Full Version: Hide Groups from Memberlist.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hey there,
I've currently been looking for ways to hide certain member groups from the memberlist. I've found a few tutorials but all were for versions 1.6 or older and I was definitely not going to try them out as most of them didn't even look compatible when comparing codes. Also a few of them required editing to the root file folders and I really didn't want to touch any of that!

So I was wondering if there was a way to go about this by either a plugin (if there are any, so far I haven't found one) or by using a template conditionals plugin (maybe even other ways?)?

My current memberlist looks like this: http://aashirya.sunwolves.com/memberlist.php

I'm wanting to hide all groups besides "ROGUE, SOCRATE, INIGO, DIONE, TAILYN" by their group ID.
Does it have to be by ID? You can hide groups by simply modifying the group and unchecking "Yes, show this group on the 'forum team' page"
(2016-01-22, 12:52 AM)nth Wrote: [ -> ]Does it have to be by ID? You can hide groups by simply modifying the group and unchecking "Yes, show this group on the 'forum team' page"

she or he wants to hide groups from memberslist page, not from forum team page. So that won't work.

now about the plugin, as far as i'm aware of, there is no such plugin for that on 1.8. You will have to do it mannually or by requesting a plugin to some developer.
This is not the forum team page. This is the Memberlist.

Also, "You will have to do it mannually or by requesting a plugin to some developer." doing it manually is what I'm asking for. How would I do such?
never done this before, but this should work. I strongly advise you to backup your memberlist.php file before doing any changes.
Ah! That was actually one of the tutorials I stumbled across while searching earlier. I don't like the way they go about this because it edits a root folder. I would like to just be able to add it into the memberlist template, which is where I think the template conditionals plugin would come in handy. HOWEVER, I'm not a professional or a very advanced coder and don't know how to go about it.

^ So I guess how to do it would be more of my question.
Oh, sorry.

You could create a plugin for this, but the plugin would need to modify core files.

You could use template conditionals, in the template memberlist_user, you will have:
	<td class="{$alt_bg}" align="center">{$user['avatar']}</td>
	<td class="{$alt_bg}">{$user['profilelink']}<br />
<span class="smalltext">
	{$user['usertitle']}<br />
	{$usergroup['groupimage']}
	{$user['userstars']}
</span></td>
	<td class="{$alt_bg}" align="center">{$user['regdate']}</td>
	<td class="{$alt_bg}" align="center">{$user['lastvisit']}</td>
	<td class="{$alt_bg}" align="center">{$user['postnum']}</td>
	<td class="{$alt_bg}" align="center">{$user['threadnum']}</td>
	{$referral_bit}
	</tr>

You can wrap a template conditional around all that and make it something like:
<if $user['usergroup'] != 1 or $user['usergroup'] != 2 then><tr>
	<td class="{$alt_bg}" align="center">{$user['avatar']}</td>
	<td class="{$alt_bg}">{$user['profilelink']}<br />
<span class="smalltext">
	{$user['usertitle']}<br />
	{$usergroup['groupimage']}
	{$user['userstars']}
</span></td>
	<td class="{$alt_bg}" align="center">{$user['regdate']}</td>
	<td class="{$alt_bg}" align="center">{$user['lastvisit']}</td>
	<td class="{$alt_bg}" align="center">{$user['postnum']}</td>
	<td class="{$alt_bg}" align="center">{$user['threadnum']}</td>
	{$referral_bit}
	</tr>
</if>

Of course, you need to change the if statement to the IDs or add more, etc.

EDIT: If you'd like a plugin, I could probably sort something out.
well, I guess you could use Template Conditionals on your boards and try it out.

about editing memberlist.php file, I would get the file to my PC, backup one and editing another. if anything goes wrong, you can always replace the file with your backup.
I could give that a try Blackbeard but I really just don't like messing with those files at all.

Also nth, a plugin would be AWESOME as I'm sure lots of people could get some use out of it, however I don't have anything to offer in return for building such a plugin. ALTHOUGH, would
<if $user['usergroup'] != 1 or $user['usergroup'] != 2 then>
show those user groups or hide them? How many 'or' statements can I create?

If in the case this only SHOWS said user groups would I be able to do it like this:
<if $user['usergroup'] != 2 or $user['usergroup'] != 10 or  $user['usergroup'] != 11 $user['usergroup'] != 12  $user['usergroup'] !=13  then>
!= in PHP means does not equal.

With the code you have provided you have also missed the 'or' clause. Change it to:
<if $user['usergroup'] != 2 or $user['usergroup'] != 10 or $user['usergroup'] != 11 or $user['usergroup'] != 12 or $user['usergroup'] != 13 then>

And that's basically:
If $user['usergroup'] does not equal 2, 10, 11, 12 or 13 then do not show them.
Pages: 1 2 3