vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   An Idea for Thread Display Order (https://vborg.vbsupport.ru/showthread.php?t=42383)

Pollo 03-30-2003 01:01 AM

Hello, all of this seems really helpful, and gets me close to what I'd like, which is:

Choose certain forums (not all) to be displayed by the time/date of initial post of each thread. In other words, once threads are posted, there isn't a way to bump them to the top. They just stay in the order they are posted.

Could anyone help with the coding for this? Needed for about 5 forums out of the total (though it seems easy to add or subtract addl. forums as needed).

GMeadows 05-08-2003 10:35 AM

This is almost perfect for what we need...

My question...how to make

if($foruminfo[forumid]==1)

apply to a range of forum id's? So that a few different sections can be sorted alphabetically.

Gary

Xenon 05-09-2003 10:39 AM

if(in_array($foruminfo['forumid'], array(a,x,y,...,z)))

Michael2 05-11-2003 04:10 PM

Ok, this is really messed up. I thought I had it until someone tried going to page 2. I have thread started for each state and want them to appear in alphabetical order. This is what I have, which (I think) should be right...

Quote:

default:
if(in_array($foruminfo['forumid'], array(74,76,77)))
{
$sortfield='title';
$sqlsortorder='';
} else $sortfield='lastpost';
}
if ($sortfield=="voteavg" and !$foruminfo[allowratings]) {
$sortfield="lastpost";
}

$sort = array();
$sort[$sortfield]='selected';
74, 76, and 77 are the three forums I want listed alphabetically. Problem is I have Alabama down through Mass. on on page 1 but then on page two it starts with Mass. at the top and goes down to Alabama.

Any ideas?

Michael2 05-23-2003 11:54 AM

Anyone? :)

LilDragonWings 06-10-2003 04:26 AM

Quote:

03-30-03 at 05:01 AM Pollo said this in Post #21
Hello, all of this seems really helpful, and gets me close to what I'd like, which is:

Choose certain forums (not all) to be displayed by the time/date of initial post of each thread. In other words, once threads are posted, there isn't a way to bump them to the top. They just stay in the order they are posted.
I'm also interested in this solution.... I'm not fluent enough to figure it out on my own yet :(

chrisvonc 01-12-2004 01:50 AM

Nice mod. Thank you, I found it very useful for a new section I am opening on my forum!

Chris

chrisvonc 03-03-2004 11:19 PM

Hi again, a follow up question if anyone is checking this...

I used this but ran into the problem that if the threads flowed over to a 2nd page, the order would start over again, repeating the threads from the 1st page. Anyway I tried Chens version (http://www.vbulletin.com/forum/showt...015#post621015) and got that working but I was wondering if it is possible to change the "Last Thread - Next Thread" links to go the next/last thread alphabetically rather than by post ID?

I am using vB 2.3.2 and the forums that I have the alpha sort applied to are using a seperate style template so if its a template change it wont impact the rest of my forum.

Or should I create a new request rather than adding to this thread?

Thanks!

Chris

Reaktor7 04-11-2005 04:34 PM

Ok guys, i beleive i have this one sorted..

What happens is with your present setup the sort order is passed onto the next page link.. With Xenons hack it overides the default. Here is my "hack" which should make it work. However, it doesnt fix an issue with teh sort arrow being rendered useless on the first click (you need to click it twice for the order to change)

Heres my code:

PHP Code:

    $forumArray = array(x,y,z); //set your forumids here
    
if (!in_array($foruminfo['forumid'], $forumArray)  AND $sortorder != 'asc')
//If its not in our special forum array, we will set the default to Descending (ie so its ordered by last post)
    
{
        
$sqlsortorder 'DESC';
        
$order = array('desc' => HTML_SELECTED);
    }
    elseif (
in_array($foruminfo['forumid'], $forumArray) AND $sortorder == 'desc')
//We have just removed the "default" setting for all forums which are in our array. This removes the ability for the list to be sorted descendingly. We now need to state it manually to get it in descending order.
    
{
        
$sqlsortorder 'DESC';
        
$order = array('desc' => HTML_SELECTED);
    }
    else
//If the above two requirements arent met, we will set the order to Ascending.
    
{
        
$sqlsortorder '';
        
$order = array('asc' => HTML_SELECTED);
    }

    switch (
$sortfield)
    {
        case 
'title':
            
$sqlsortfield 'thread.title';
            break;
        case 
'lastpost':
        case 
'replycount':
        case 
'views':
        case 
'category':
        case 
'postusername':
            
$sqlsortfield $sortfield;
            break;
        case 
'voteavg':
            if (
$foruminfo['allowratings'])
            {
                
$sqlsortfield 'voteavg';
                break;
            } 
// else, use last post
        
default:
            if (
in_array($foruminfo['forumid'], $forumArray))
//if we are viewing a forum in our array, we need to set it to default to ascending, and sort by the title.
            
{
                
$sqlsortfield 'thread.title';
                
$sortfield 'title';
            }
            else
//If not, we set it to the default sort order: descending.
            
{
                
$sqlsortfield 'lastpost';
                
$sortfield 'lastpost';
            }
    } 

Hopefully this helps you our whoever needs it.. I wouldnt class this a hack by anymeans.. but if you do need some help.. Let me know ;)

Fixed the sorting arrow issues -
find:
PHP Code:

    $oppositesort iif($sortorder == 'asc''asc''asc'); 

replace with
PHP Code:

    if (in_array($foruminfo['forumid'],$forumArray))
    {
        if(
$sortorder == 'asc' OR $sortorder == '')
        {
            
$oppositesort 'desc';
        }
        else
        {
            
$oppositesort 'asc';
        }
    }
    elseif (!
in_array($foruminfo['forumid'],$forumArray))
    {
        
$oppositesort iif($sortorder == 'asc''desc''asc');
    } 

hope this helps anyone who needs it

Bernievn 08-18-2006 05:24 PM

I'm now running VB 3.5.

I tried the following which does not change the display. What am I doing wrong?

default:
$handled = false;
($hook = vBulletinHook::fetch_hook('forumdisplay_sort')) ? eval($hook) : false;
if (!$handled)
{
$sqlsortfield = 'lastpost';
$sortfield='title';

Thanks Bernie


All times are GMT. The time now is 03:59 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.01143 seconds
  • Memory Usage 1,767KB
  • 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_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete