vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Force Forumdisplay Sort Order (https://vborg.vbsupport.ru/showthread.php?t=271973)

bitwise2000 10-13-2011 01:56 PM

Force Forumdisplay Sort Order
 
I need to force the thread sort order (i.e. override user selection) for a couple forums to Thread Start Time, Descending. I'd also like to remove the user's ability to change the sort order for those forums.

What is the best way to accomplish this?

Thanks

Lynne 10-13-2011 03:20 PM

hook - forumdisplay start:
PHP Code:

$_REQUEST['sortfield'] = 'dateline';
$_REQUEST['sortorder'] = 'desc'

That will force it no matter what the user selects. You may add a condition around that to only show on certain forums. Check out the article on conditions.

bitwise2000 10-13-2011 07:07 PM

Thank you, Lynne.

--------------- Added [DATE]1318538968[/DATE] at [TIME]1318538968[/TIME] ---------------

I understand a bit better what I'm trying to do, so let me restate.

I only want threads to be bumped by the OP in selected forums. Followups by others should not. We have a classifieds forum where many people comment on for-sale posts, which causes unnecessary bumping of the thread when the sort is Last Post Time. We still want to enable the OP to bump their own thread.

I envision two solutions;

(1) not update the lastpost field in the thread table when a post is made unless that post is made by the thread starter.

(2) Manipulate the query in forumdisplay that generates the recordset for thread display, substituting the time of last post by the OP for lastpost from the thread table. That requires a subquery into the post table for each threadid to be displayed.

As long as I'm willing to mess up the data integrity for a couple forums, this seems like the easier solution.

Anyone done something similar? Got a tip or two?


All times are GMT. The time now is 06:04 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.01205 seconds
  • Memory Usage 1,711KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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