vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   SQL Sort Field not working in 3.8? (https://vborg.vbsupport.ru/showthread.php?t=203922)

xlguy 02-02-2009 10:00 AM

SQL Sort Field not working in 3.8?
 
I'm trying to use this plugin to put open topics above closed topics:

PHP Code:

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

Quote:

Originally Posted by Lynne (Post 1732024)
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 [DATE]1233763842[/DATE] at [TIME]1233763842[/TIME] ---------------

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 [DATE]1233767540[/DATE] at [TIME]1233767540[/TIME] ---------------

Solved! Hope this helps others...

Hook location: forumdisplay_query_threadid

PHP Code:

if (in_array($foruminfo['forumid'], array (XXXXXX))) {
$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 - such a nice guy :)


All times are GMT. The time now is 05:02 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01032 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete