vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   sorting threads (https://vborg.vbsupport.ru/showthread.php?t=22967)

Ne0 07-17-2001 02:17 PM

Anyone know if you can add an option like "sort threads by date thread started" into the drop-down list at the bottom of a page?

Mentor 07-17-2001 04:14 PM

Ill make this for you. But how about a link on top next to the other "sort by" links?

Mentor 07-17-2001 04:53 PM

Make a copy of newthread.php and forumdisplay.php now!!!

Then open newthread.php On line 209 replace

PHP Code:

      $DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastposter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($subject))."','".time()."','$forumid','1','0','".addslashes($postusername)."','$bbuserinfo[userid]','".addslashes($postusername)."','".time()."','$iconid','$visible','$attachcount')"); 

with
PHP Code:

      $DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastposter,dateline,iconid,visible,attach,datestarted) VALUES (NULL,'".addslashes(htmlspecialchars($subject))."','".time()."','$forumid','1','0','".addslashes($postusername)."','$bbuserinfo[userid]','".addslashes($postusername)."','".time()."','$iconid','$visible','$attachcount','".time()."')"); 


Save and close. Then, Execute the folowing command on your vbulletin mysql database.

Code:

ALTER TABLE thread ADD datestarted VARCHAR (50) not null
Open forumdisplay.php and around like 308 find
PHP Code:

switch ($sortfield) {
  case 
'title':
  case 
'lastpost':
  case 
'replycount':
  case 
'views':
  case 
'postusername':
  case 
'voteavg'

and change that to
PHP Code:

switch ($sortfield) {
  case 
'datestarted':
  case 
'title':
  case 
'lastpost':
  case 
'replycount':
  case 
'views':
  case 
'postusername':
  case 
'voteavg'

Then, around line 401 find
Code:

lastposter,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach
And replace with
Code:

lastposter,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach,datestarted
Save that.

Now, login to your admin and change the folowing templete
forumdisplay_threadslist

Find
PHP Code:

<select name="sortfield">
        <
option value="title" $sort[title]>thread title</option

and right under that add

PHP Code:

<option value="datestarted" $sort[datestarted]>date started</option


Well, that should do it!... I tested it and it works...dont know how it will effect posts b4 this hack was installed.. :(

Mentor 07-17-2001 04:55 PM

Haha...something is wrong with my trailing PHP tag :( its there, just dont want to work!

Paul 09-25-2002 08:57 AM

Why not just use thread.dateline? What's the reason for adding the additional field?


All times are GMT. The time now is 08:40 AM.

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.01237 seconds
  • Memory Usage 1,733KB
  • 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
  • (3)bbcode_code_printable
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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