View Full Version : SQL Sort Field not working in 3.8?
xlguy
02-02-2009, 10:00 AM
I'm trying to use this plugin to put open topics above closed topics:
if (in_array($foruminfo['forumid'], array(1,5)))
//separate numbers with commas
{
$sqlsortfield = 'open DESC, '. $sqlsortfield;
}
At the forumdisplay_query hook location. It worked in 3.6 but hasn't ported to 3.8. Any ideas?
Lynne
02-02-2009, 03:03 PM
You might want to try $thread or $threadinfo instead of $foruminfo.
xlguy
02-02-2009, 03:15 PM
Right, but I want this on a per-forum basis, that's the only reason I have that loop.
Not sure why it's not working!
Lynne
02-02-2009, 03:27 PM
Threads have a forumid associated with them. Did you try what I suggested?
Dismounted
02-03-2009, 04:31 AM
Verify that you are actually getting inside the loop (add an exit; inside the loop).
xlguy
02-04-2009, 08:19 AM
Threads have a forumid associated with them. Did you try what I suggested?
But that would test each thread to see which forum it is in. The loop there is to basically say "Should we apply open above closed in X, Y or Z forum". I'm not sure what you're suggestion is, can you clarify? :)
--------------- Added 1233763842 at 1233763842 ---------------
Update: What seems to be happening is that sorting is happening (open above closed threads) but only on a page by page basis. So if I go to page 2, the open ones are above the closed ones on that page. But obviously I want all the open ones at the top of page #1.
--------------- Added 1233767540 at 1233767540 ---------------
Solved! Hope this helps others...
Hook location: forumdisplay_query_threadid
if (in_array($foruminfo['forumid'], array (XX, XX, XX))) {
$sqlsortfield = 'thread.open DESC, ' . $sqlsortfield;
}
Replace XXs with forumids where you want open threads above closed, useful for Reported Posts forum for example.
A big thank you to Darkwaltz4 (https://vborg.vbsupport.ru/member.php?u=22807) - such a nice guy :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.