Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Hiding and Ordering User Groups in Member List
Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Nov 29, 2012 - 9:13 pm

This post almost answered my question.

But what if I want to hide certain user groups from all members while allowing all members to see other groups?

We have a Vets group we want everyone to be able to see and search in the Members list. We also have a private group with permissions beyond Moderator but not quite Admin, the membership of which we prefer to keep private. I notice now, however, this group is appearing on the Members search/list page.

Is there any way to edit this spMembersView.php template function to show specific groups, in the order I want them?

if (sp_has_member_groups('usergroup', 'id', 'asc', 15, true)) {

It appears the only order option is ascending or descending, any way to customize the order by group id?

Thanks in advance for any direction!

PS: Wouldn't it just be dandy if there was an option on the Edit User Group tab of the Manage User Groups admin pane to "Hide Group from Members List"? cool

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Nov 30, 2012 - 12:26 am

first, the sort order of ASC and DESC is really determined by MySQL.. you can order and the sort ascending or descending...  so not a lot of options there...

not sure exactly what you want either...  but keep in mind that we are just dealing with php here... so you have a lot of options - infinite almost... also, keep in mind the actual prototype of the sp_has_member_groups() constructor...

sp_has_member_groups($groupBy='usergroup', $orderBy='id', $sortBy='asc', $number=15, $limitUG=false, $ugids='')

so if you want to specify the user group ids that can be seen, just specify them in the last argument $ugids... and if you want to change that base on who is logged in, why not something like:

$member = sp_check_membership(6, $spThisUser->ID);
if (!empty($member)) {
    $ids = '1,2,3,4,5,6';    
} else {
    $ids = '1,2,3';    
}

if (sp_has_member_groups('usergroup', 'id', 'asc', 15, false, $ids)) {

basically, this checks if the current user is a member of usergroup 6.. if so, then the members list will show usergroups 1, 2, 3, 4, 5 and 6...  if not, then only usegroups 1, 2, and 3 will be shown...

of course, the options are limitless...

 

Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Nov 30, 2012 - 12:13 pm

Excellent, as usual. I've got the desired user groups displaying only to those members I want to see them on the Members search/list page. Thank you!

Sorting the group order, however, is still proving to be a challenge. I guess I'm not clear on the sort/order asc/desc business...

1. How can I show the groups in the order I want them (e.g.; 9,3,10,7,2)?

2. It appears that members within the groups are sorted in alpha order. It also appears that the asc/desc attribute determines order of both the groups and the members within each. How might one sort members withing groups by User ID (to reflect join date), and then ascend or descend as desired?

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Nov 30, 2012 - 12:38 pm

meant add a blurb about that last night... you wont be able to sort them that easily... mysql doesnt support that kind of sorting... so you will have to sort the data after its returned from the query... and looking real quick at the class, we really dont have a filter or method to give you access to the raw data or the sorted data...

but the theme is still php... so you can probably organize the data however you want... take a look at the data inspector on forum - toolbox - data inspector... in the member view section, turn on the spMembersList data display... then on the front end you will see how all the members data is organized and should be able to pull out the pieces you want in the order you want... you will have to make changes to your spMembersView.php template file to loop through the data yourself rather than using our built in loop...

so not super simple, but think its doable...

Avatar
jim
Here and Now
Member
Pro Subscribers
sp_UserOfflineSmall Offline
Nov 30, 2012 - 5:19 pm

Thanks again, will need to ruminate on this one. Not that important now.

Certainly appreciate the previous tips for selectively showing groups, though!

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Nov 30, 2012 - 6:16 pm

no problem!  ask if you have any questions... but start looking at the data... you will see it sorted, but with your usergroup ID you could pull the data out as you want..

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625