MyBB Community Forums

Full Version: Better Usergroup Legend
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi I was wondering if anyone could make a plugin that shows all the user groups at the bottom of the index like so:

[Image: E6kHo4f.png]

but allows you to customize the order of the groups. The one we currently have is viewgroups 1.6 but it orders them based off of gid, which puts them in an awkward order.

Thanks.
You can continue to use the plugin with a few changes.

Search in ROOT/inc/plugins/viewgroups.php for (#222):
$query = $db->simple_select("usergroups", "gid,title,namestyle", "gid NOT IN ('".str_replace(',', '\',\'', $mybb->settings['viewgroups_groups'])."')");

Replace all with:
$query = $db->simple_select("usergroups", "gid,title,namestyle", "gid NOT IN ('".str_replace(',', '\',\'', $mybb->settings['viewgroups_groups'])."')", array("order_by" => 'title',"order_dir" => 'ASC'));

Save changes and reload index page.
Now the groups will shown in alphabetical ordering.

***************

Also you should fix the displaying of default avatars in group user list

Search in ROOT/inc/plugins/viewgroups.php for (#385):
$user['avatar'] = '';

Replace all with:
$user['avatar'] = '<img src="'.$mybb->settings['useravatar'].'" width="70" height="70" />';
(2015-09-24, 11:47 AM)SvePu Wrote: [ -> ]You can continue to use the plugin with a few changes.

Search in ROOT/inc/plugins/viewgroups.php for (#222):
$query = $db->simple_select("usergroups", "gid,title,namestyle", "gid NOT IN ('".str_replace(',', '\',\'', $mybb->settings['viewgroups_groups'])."')");

Replace all with:
$query = $db->simple_select("usergroups", "gid,title,namestyle", "gid NOT IN ('".str_replace(',', '\',\'', $mybb->settings['viewgroups_groups'])."')", array("order_by" => 'title',"order_dir" => 'ASC'));

Save changes and reload index page.
Now the groups will shown in alphabetical ordering.

***************

Also you should fix the displaying of default avatars in group user list

Search in ROOT/inc/plugins/viewgroups.php for (#385):
$user['avatar'] = '';

Replace all with:
$user['avatar'] = '<img src="'.$mybb->settings['useravatar'].'" width="70" height="70" />';

Thanks man, I'll give it a try.