Support Forum

Members list – Admins&Members but no Moderators

CF Conrad_Farlow
Conrad_Farlow
Member

As Admin the members list is populated with Admins, then members and finally Moderators.

A normal user sees Admins and Members but not Moderators. I seem to remember that this was an option in V4.x but I don’t remember setting this in V5.0. If I did I can’t remember how or where, can someone remind me.

20 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

I am not aware of that ever being an option but am open to correction of course.
It looks more likely to be a bug to me and I will open a ticket for investigation.

MP Mr Papa
Mr Papa
Member

this is as designed, I am afraid…  by default, in the members list template tag, our themes set a flag that limits usergroups that a user can view to the usergroups that the user is a member of… since they are not a member of the moderators usergroup, they wont see it… 

this prevents users from seeing private usergroups or knowing about them…

if you dont have private forums or private usergroups, you can change that option to false (show all usergroups) in the members view template file… 

we are talking about ways to change to include moderator usergroups for forums that the user has permission on… but its a significant rewrite and may get pushed to a later release…

CF Conrad_Farlow
Conrad_Farlow
Member

Then all is OK Steve; we only have 3 user groups that are allowed to view the forum – members, moderators and administrators so setting the flag is fine for me.

Conrad

ER ernohannink
ernohannink
Member

Cool – like this. I want the people in a group called ‘Group 1’ only to see the members of that group.

Now members of group 1 also see a list of the admins. Can that be switched off somehow? I want some admins not visible to the group members.

YS Yellow Swordfish
Yellow Swordfish
Member

I am going to need Steve (Mr Papa) to step in here as I am somewhat unfamiliar myself with the members list class but I suspect the only way to do this would be with a database query filter. Hopefully Steve can expand on that later…

MP Mr Papa
Mr Papa
Member

no, sorry…  admins are visible to all users in the member list…

there is a filter on the query, so you could add a function that filters the query based on the current user and their memberships…

ER ernohannink
ernohannink
Member

Thank you – you mean directly in spMembersView.php?

Or do you do this in functions.php?

YS Yellow Swordfish
Yellow Swordfish
Member

No. How much do you know about using WordPress filters? If not a lot… then first step would be to check them out in the WP Codex.

The members list class provides a filter named ‘sph_members_list_query’ which passes a query object. So in the theme spFunctions.php file you can use the

 

add_filter('sph_members_list_query', 'your_function_name');

call to create your own function to manipulate the SQL.

function your_function_name($spdb)

The $spdb object contains the following properties:

$spdb->table
$spdb->fields
$spdb->found_rows
$spdb->distinct
$spdb->left_join
$spdb->where
$spdb->orderby
$spdb->limits

I warn you though that this query is somewhat complex and is due to be reviewed in a future release (i.e., a 5.1 or later) to make it simpler – possibly breaking into more than one query.

CH chantalcoolsma
chantalcoolsma
Member

Easiest way would be if you could give the admins group a different class than spMemberGroupsSection. Then you could just hide it using CSS. Now all membergroups have the same class spMemberGroupsSection.