Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: stomic on February 09, 2009, 11:48:35 AM

Title: SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)
Post by: stomic on February 09, 2009, 11:48:35 AM
Hi!

I have upgraded from SMF 1.1.8 to 2.0RC1 with MySQL and then ported the database to SQLite. This wasn't an easy task, and I still hope it all went well.

Anyway, what I noted is that my boards are not sorted according to the order that is setup in the configuration (admin section). This sorting order is preserved in the database but wasn't respected when the board index is shown.

I found a solution, which I hope is good enough. I'm writing here to share the solution with you, in case that somebody else encounters the same problem.

So, I edited the file Sources/Subs-BoardIndex.php and on line 74-77 I replaced:

AND b.child_level >= {int:child_level}') : '
AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)),
array(


with

AND b.child_level >= {int:child_level}') : '
AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)) . ' ORDER BY b.board_order',
array(


Title: Re: SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)
Post by: stomic on February 09, 2009, 11:50:08 AM
Do you think the solution is good enough?

And I haven't tested it with other database engines...
Title: Re: SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)
Post by: karlbenson on February 22, 2009, 03:59:53 PM
That would work.

Usually smf re-orders the boards inside the db so that the order by is not required.
Your porting to sqlite (which won't do it) from mysql (which will do it)

It might be caused by your porting or it could be an sqlite bug.
I will check this out.
Title: Re: SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)
Post by: karlbenson on February 22, 2009, 08:04:07 PM
Added to the bug tracker.
http://dev.simplemachines.org/mantis/view.php?id=3221
Title: Re: SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)
Post by: stomic on February 23, 2009, 09:31:44 AM
thanks!
Title: Re: SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)
Post by: feline on February 22, 2012, 07:15:28 AM
Seems like this bug is not fixed in 2.02 ..
I don't see a ORDER BY ... in the file Sources/Subs-BoardIndex.php as described above.
So I wonder me why the issue have status resolved ...
Title: Re: SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)
Post by: Ensiferous on April 27, 2012, 06:45:39 PM
Confirmed. I just ran into this bug and had to fix it with ORDER by as well.
Title: Re: SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)
Post by: FragaCampos on January 17, 2013, 01:42:08 PM
Sorry to unearth this topic, but I'm doing some tests on localhost and I updated my SMF from 1.7 to 2.03 and I ran into this same problem. Although the boards are correctly set on admin panel, the index of the forum shows them differently. Is stomic's solution the correct and best one?