News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Limiting Memberlist View

Started by akhione, December 28, 2012, 04:45:34 AM

Previous topic - Next topic

akhione

How can I limit memberlist view for regular members to their own group only?

Ricky.

I guess its not possible in default SMF setup, you may either ask someone to make mod for that or do it yourself.
Request mod here :
http://www.simplemachines.org/community/index.php?board=79.0

Ask someone to develop for you here:
http://www.simplemachines.org/community/index.php?board=50.0

akhione

Is there a simpler way in doing this? I mean a really simple modification without creating a mod package. I found out that the view by membergroups is already available in SMF 2.0 via Groups.php code where it provides action=groups;sa=members;group=

Can I simply remove Memberlist from Subs.php and replace it with this instead?

'mlist' => array(
'title' => $txt['members_title'],
'href' => $scripturl . '?action=groups;sa=members;group='[USERMEMBERGROUPID],
'show' => $context['allow_memberlist'],
'sub_buttons' => array(
),
),


There must be a way of detecting and inserting user membergroup id in [USERMEMBERGROUPID] automatically. I found this thread but I am not sure how he coded it: http://www.simplemachines.org/community/index.php?topic=330834.0

Kindred

Do note that doing tha will not actually limit anything. It will start by displaying just the group that you list, but the user can remove the group line from the URL and see the entire member list.

And what happens if a user is in multiple groups?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

akhione

Thanks for the advice. But at this point I will try to make it work rather than looking for perfection. If somebody knows the answer on how do I get user membergroup id and automatically insert it in the place that I have shown in my second post above, do share. I just want to make it work for that line for the time being.

I also found that if I can add something like if ($context['user']['is_admin'] || $context['user']['is_mod']) at the right place somewhere in Groups.php or in ManageMember template, I might be able to stop members from viewing the groups for a while. I am not sure where, but I am sure I can find it out sooner or later.

akhione

I have resolved some of the problem using an advice from this thread: http://www.simplemachines.org/community/index.php?topic=346051.0 to get primary user group ID and by removing default mlist menu to this one:

'groups' => array(
'title' => $txt['members_title'],
'href' => $scripturl . '?action=groups;sa=members;group=' . $user_info['groups'][0],
'show' => allowedTo('view_mlist'),
'sub_buttons' => array(
),
),


Currently, I will only use primary member group (as there could be more than one additional groups and I am not sure how it will look like if more than one group is called at the url). The member groups is still accessible via action=groups which I intend to limit soon.

I hope someone can guide me on how to use some of the code in Groups.php that create this sa=members;group= to Memberlist.php so that I can simply use it via action=mlist instead but limited to user own group only. Again, will all good code already in SMF, I really think that it should be a simple modification.

Advertisement: