The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Hello, I want to maintain the same sortorder in forumdisplay as default for paging and such (latest threads first), but I want to sort the threads returned by the database with php.
I thought I could use $sortfield for that, but I have tried this code $sortfield = "thread.title"; $sqlsortfield = 'lastpost'; $handled = true; booth in the forumdisplay_start and the forumdisplay_sort, but it just won't work. |
#2
|
||||
|
||||
![]()
You set that in Forums & Moderators > Forum Manager > select the forum to edit > Default Sort Order/Default Sort Field
|
#3
|
|||
|
|||
![]()
ok, but I want to hook up a new sort of the result I get from the database. (so I dont want to change the way the results are sorted by the database)
my db-query looks something like this: select a,b,c from threads where ... order by lastpost desc I want to keep that sortorder, so that on each page I move through show me older posts as I go on. but then on the listning (of that specific page) I want to order the results based on a new column that I have created in the database. This column tells if a thread is 'marked as solved' or not. I want to show booth the solved and not solved threads in the page as normal, but instead of just sorting it by lastpost desc, I want to sort it by solved, lastpost desc. So that the unsolved threads is shown first, and then the solved ones. We did this modification without the plugin/hook-system (before 3.5) by modifying the forumdisplay.php, but now when we upgrade we need to convert this to plugin code, for easier upgrades of vbulletin. |
#4
|
||||
|
||||
![]()
You need to use a hook that is called right before the query you are trying to modify. Like the hook forumdisplay_announcement_query is right above the announcement query, and forumdisplay_query_threadscount is right above the threascount query. The variables get emptied right before the query hooks:
PHP Code:
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|