News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[4737] Sort order of board list in membergroup management

Started by habakuk, May 26, 2011, 04:03:07 AM

Previous topic - Next topic

habakuk

SMF 2.0rc5
MacOSX 10.6.x
Apache 2.x
PHP 5.3.x
Postgresql 8.3.x
Using English UTF-8 and German UTF-8

Verified on Default template and english language.

------------------------------------------------------------------------------------------------------------
Problem:

I do have sub-boards with e.g. the name "Contribution" in several boards.

When creating a new membergroup I (obviously) want to define which boards they can access.

The board list in the section "visible boards" in the membergroup seems to be ordered by the board ID, which represents the sequence of adding the boards.

The sub-boards are indented but wrongly associated.

A) Suddenly boards with no subboards get a subboard in that listing.

B) Since the names of the subboards are not unique, I cannot know which subboard is now listed where, except I know the board ID and sort them in my mind so to guess where they might appear in the list.

------------------------------------------------------------------------------------------------------------

Workaround:

- Lookup the IDs /  reconstruct the sequence the boards were added.
- Or: rename the non-unique boards to give them unique names, set the privileges and then rename them again...

------------------------------------------------------------------------------------------------------------

Solution:

Construct the list of boards in the same way, the boards are actually displayed on the board index page.

cheers
®





emanuele

Confirmed.

A "quick" fix (seems to work also with mysql) could be to edit ManageMembergroups.php replace:
$result = $smcFunc['db_query']('', '
SELECT id_board, name, child_level
FROM {db_prefix}boards',
array(
)
);


with
$result = $smcFunc['db_query']('', '
SELECT id_board, name, child_level
FROM {db_prefix}boards
ORDER BY board_order',
array(
)
);


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

habakuk

Thanks, emanuelle. Tried it but it doesn't seem to work the way it should. I get the same results in the actual display.
I see, the board_order would be the proper way to sort them, but somehow that query doesn't translate into the
display on my system.

I get the boards ordered by the way the postgres table returns them when NOT issuing a ordered list.

See attachements. Screenshot one is the list that I get in the manage boards section, screenshot two is the one i get
in the manage membership groups > visible boards section.



habakuk

oh and btw: shouldn't you specify the sort order? Like:


$result = $smcFunc['db_query']('', '
      SELECT id_board, name, child_level
      FROM {db_prefix}boards
      ORDER BY board_order ASC',
      array(
      )
   );

emanuele

I'd say use it is good practice, but ASC is the default if nothing is specified so it should not be a problem.

Could you please try to move one board in another position and then move it back and see if it works? (just guessing, but I remember I read something like this somewhere here around maybe for something else...but I think it's worth a try... :))


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

habakuk

Didn't help. I've checked the database and if the query would actually use those values there, the sort order would be fine.

See attachement. The query shown at the top delivers the values as expected. So, that would be ok. Somehow something gets mixed up otherwise.

cheers
®

emanuele

Of course, of course!! :D
My fault: I was thinking only about adding a member group, but of course there is also the edit!!

So find:
Code (find) Select
$result = $smcFunc['db_query']('', '
SELECT id_board, name, child_level, FIND_IN_SET({string:current_group}, member_groups) != 0 AS can_access
FROM {db_prefix}boards',
array(
'current_group' => (int) $_REQUEST['group'],
)
);


and replace with:
Code (replace with) Select
$result = $smcFunc['db_query']('', '
SELECT id_board, name, child_level, FIND_IN_SET({string:current_group}, member_groups) != 0 AS can_access
FROM {db_prefix}boards
ORDER BY board_order ASC',
array(
'current_group' => (int) $_REQUEST['group'],
)
);


And now it should work! :D


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

habakuk

Yes! Now it works as expected! Thanks for the help.

No longer a bug report, but rather a feature request would be to have the categories listed too. Just like when
the move board interface is shown. That would increase the readability of the listing quite a bit.

cheers
®

emanuele

You are welcome! :)
Thank you to find the time to report the bug.

That's a rather interesting idea!
I'd suggest you to open a topic in the feature requests board so it will be easier to remember (and to find since this is still a valid bug report). ;)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

The mod is approved since a long time now, but I forgot to post it: so here it is. :)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Norv

Thank you, ema!

* Norv thinks we should update the mod for 2.0.1. ;)
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

emanuele

* emanuele is no more active doc writer, but lazy dev.... :P

Okay, today is the "update-my-mods" day. O:)

And BTW: the emulation is there to be used! :P


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: