PDA

View Full Version : <!--#--> ordering


AllanZ
08-23-2012, 02:15 PM
Is it possible to use <!--#--> to order sticky threads? I know it is with usergroups, just wondering what I would have to do to get that to work with forum titles so I can order my sticky threads.

Eosian
08-23-2012, 02:42 PM
No, sorting of threads is handled by whatever defaults are set on a per forum basis, or by whatever sort options are passed in the event the user uses the forum sorting tool bar.

If you add a field named stickysortorder to the threads table, default it 0 (or 99, depending on your native sort direction) and add a plugin to the forumdisplay_query hook to set the following variables;

$sqlsortfield
$sqlsortorder
$sqlsortfield2

Into approximately;

$sqlsortfield2 = $sqlsortfield;
$sqlsortfield = " stickysortorder ";

You could jury rig it and manually set the stickysortorder on your threads to what you want. The biggest flaw in this, aside from the potential for something else to already be using both sort variables, is that unless you change forumdisplay.php physically both sort fields use the same sortorder. Your default value needs to be higher/lower than your intended "used" sort order and correspond directly to your default sort direction, so it takes some tweaking.

There isn't any hook between forumdisplay_query and the actual processing of it's array that you can use to rearrange the sort order, which is determined by that query, is hard coded to do stickies first, then whatever the sort order requested was.

Alternative Sorting is not something vBulletin is very flexible on, most of the things you'd like to sort are hardcoded and offer no hooks to override.