Page 1 of 1

UCP "Usergroups" Tab Frustration

Posted: Fri Jul 08, 2011 9:57 am
by Auridesion
So...

Yeah. I don't like the way groups are organized on the "Usergroups" tab in the UCP. From what I can tell, it decides to show them in the following order:
  • Open groups
  • Special/pre-defined groups
  • Hidden groups
  • Closed groups
  • Request groups
(All of the groups that are "freely open" are listed alphabetically, and then it shows the special groups in alphabetical order, and so on.)

I've seen a lot of people moaning about how to change the order of groups in the legend on the board index (and understandably so), but I couldn't find anything about the order of groups as they appear in the "Usergroups" tab in the UCP. So, I suppose I'm wondering, first of all, if I'm alone with this particular bit of frustration, and if not... does anyone know of a way I can change what order my groups show up here?

I've been using phpBB for several years now, but I am still relatively new to PHP scripting. So, the first thing I did was check the files I thought might be affecting this, and in constants.php I did find the following:

Code: Select all

// Group settings
define('GROUP_OPEN', 0);
define('GROUP_CLOSED', 1);
define('GROUP_HIDDEN', 2);
define('GROUP_SPECIAL', 3);
define('GROUP_FREE', 4);
Something tells me that it isn't a coincidence that my groups show up in reverse-numerical order as defined here. But, I didn't want to go messing around with the base code here without knowing exactly what it'll do, lest I end up with undesirable effects.

Hopefully someone else here will have some thoughts for me. xD

Re: UCP "Usergroups" Tab Frustration

Posted: Fri Jul 08, 2011 1:34 pm
by Lumpy Burgertushie
Personally, I see no problem and don't know why this would matter to anyone at all.

However, if I wanted to change it, I would rearrange them in that spot in the code and see what happens.

As long as you backup the file before you edit it, you can't hurt anything that you can't fix in about 10 seconds.

go for it........

robert

Re: UCP "Usergroups" Tab Frustration

Posted: Fri Jul 08, 2011 7:17 pm
by Auridesion
Well, for the board in question, it matters to me because of the fact that I've got well over twenty usergroups, and they're pretty evenly divided up under "closed," "request," and "open" (and, of course, "special"). Which means the total list looks really jumbled up and appears to have no coherent order to it. On forums I've admin'ed in the past, this has never really been much of an issue, because I very rarely included THAT MANY groups.

I suppose I'll give it a go and see what it does to play with the numbers. >.<

Re: UCP "Usergroups" Tab Frustration

Posted: Sat Jul 09, 2011 1:20 am
by Pony99CA
If you're lucky, you'll only need to change the ORDER BY clause of one SQL statement in one of the UCP PHP files. I don't have the code handy right now, but I can probably check later.

Steve

Re: UCP "Usergroups" Tab Frustration

Posted: Sun Jul 10, 2011 8:44 pm
by Pony99CA
Auridesion wrote:I've been using phpBB for several years now, but I am still relatively new to PHP scripting. So, the first thing I did was check the files I thought might be affecting this, and in constants.php I did find the following:

Code: Select all

// Group settings
define('GROUP_OPEN', 0);
define('GROUP_CLOSED', 1);
define('GROUP_HIDDEN', 2);
define('GROUP_SPECIAL', 3);
define('GROUP_FREE', 4);
Something tells me that it isn't a coincidence that my groups show up in reverse-numerical order as defined here.
It's not a coincidence. The code is using SQL queries with an

ORDER BY g.group_type DESC, g.group_name

clause to sort the groups first by type and then by name.
Auridesion wrote:But, I didn't want to go messing around with the base code here without knowing exactly what it'll do, lest I end up with undesirable effects.
If you change the values here, you'll need make similar updates to the group_type column of the groups table. Changing the values in the file you listed will only affect what happens to new group changes, and without corresponding changes in the groups table, things would get out of sync.

Regardless, changing those values won't affect the sorting of existing groups without changing the groups table, and even then it won't be alphabetical unless you changed group_type to be the same for all groups (a bad idea).

I've created some fake groups on my test board and have identified three SQL queries to change that should affect how groups are sorted. Once I've tested the changes, I'll post back here.

Steve

Re: UCP "Usergroups" Tab Frustration

Posted: Mon Jul 18, 2011 1:34 am
by Pony99CA
Here are the code changes to "fix" this in phpBB 3.0.8 (I haven't upgraded to 3.0.9 yet, but the file doesn't appear to have changed, so it should work in 3.0.9 exactly the same):

In /includes/ucp/ucp_groups.php, find (line #297):

Code: Select all

ORDER BY g.group_type DESC, g.group_name';
and replace with:

Code: Select all

ORDER BY g.group_name';
then find (line #354):

Code: Select all

ORDER BY group_type DESC, group_name";
and replace with:

Code: Select all

ORDER BY group_name";
then find (line #1089):

Code: Select all

ORDER BY g.group_type DESC, g.group_name';
and replace with:

Code: Select all

ORDER BY group_name';
As always, make a backup of the original code just in case.

Steve

Re: UCP "Usergroups" Tab Frustration

Posted: Wed Jul 20, 2011 11:02 am
by Auridesion
Effing heist, Steve! You're awesome! xD

I've been sidetracked with design stuff since I posted this thread -- but I haven't forgotten my qualms about this. I didn't actually change that file I originally quoted from (like I said, I got distracted with design elements of the website); and now I'm glad I didn't.

I just wanted to say thank you, Steve -- for figuring all that out for me (and anyone else who might want to know about it). I'm still carried away at the moment with my epic design-detour at the moment, so I'll try out this solution in a day or two when I have time for it. But, the point is: THANK YOU. xD