MyBB Community Forums

Full Version: Memberlist Sort By Group
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I would really like to be able to sort my member list by choosing a member's group to display - eg 'Admin', 'Moderator', 'Group A', 'Group D' etc., probably by using the 'Sort By' option at the bottom of the memberlist page.

Unfortunately I'm still learning MyBB and I haven't any idea how to go about making this possible.

Any assistance would be greatly appreciated, thank you!
Hello, thanks for choosing MyBB to be your forum software.

I don't think it's possible without a plugin.

To sort the Members List go to

Admin CP -> Configurations -> Members List

Then choose what you want it to be sorted by default.

You can sort by
  • Registration Date
  • Post Count
  • Username
  • Last Visit
Sort Order:
  • Ascending
  • Descending
If you need any other support feel free to reply.
Thanks for your reply; that's not quite what I was after.

I was kind of thinking something more like how the alphabet is available for sorting option, but with user groups - I just thought it might be easier if it were included in the 'Sort' options instead of with the alphabet. Sorry, I probably didn't explain myself very well.
I've tried it based on this guidance but could not get through it with simple modifications.

at present I'd suggest to use View Groups plugin which serves a similar purpose & could be useful
Thank you .m.; while not exactly what I'm after, it will certainly get the job done.
Maybe this?

$plugins->add_hook("memberlist_medium", "my_function");

my_function()
{
global $mybb, $sort_field, $sorturl, $searchurl;
$mybb->input['sort'] = "usergroup";
$sort_field = "u.usergroup";
$sorturl = htmlspecialchars_uni("memberlist.php?perpage=" . $mybb->input['perpage'] . $searchurl);

$search_url = htmlspecialchars_uni("memberlist.php?sort=" . $mybb->input['sort'] . "&order=" . $mybb->input['order'] . "&perpage=" . $mybb->input['perpage'] . "{$search_url}");
}
Hi, dragonexpert

I'm not really sure where to put this code to see if its what I want.

Thank you
That would be code for if you attempted to do a plugin. You would need to have an _info, _activate, and _deactivate function. See the Plugins Section of the docs for more information.