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)

memobug 08-16-2002 09:27 PM

An Idea for Thread Display Order
 
Would it be possible to create a hack that would allow the default thread display order for certain forums to be set to Alphabetical? I am thinking for book lists and FAQs this would be a nice feature.

Obviously the user can click the THREAD button to reorder the posts alphabetically or reverse alpha, but certain information-only forums really would benefit from a default presentation like this, plus very few new users know they can reorder the display of threads by thread/starter/replies/views/rating or Last Post.

Maybe what I am actually suggesting is that the admin could be able to select any of these options:

thread title/starter/replies/views/rating/lastpost

could be configurable as the Thread sort order, able to override "last post" order, which would remain the default.

Regards,

Matt

Sho 08-17-2002 09:39 PM

Very nice idea, actually.

Xenon 08-17-2002 11:30 PM

in your forumdisplay.php you can find this:
PHP Code:

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

  default:
    
$sortfield='lastpost';


just change $sortfield='lastpost'; into $sortfield='title';

memobug 08-17-2002 11:45 PM

But, that would change all the forums to the new order (alphabetic or views, etc) wouldn't it? I was really hoping to just affect one or two - the faq sorted by alpha; the booklist sorted by rating, and so forth.

Regards,

Matt

Xenon 08-18-2002 12:25 AM

replace it with an if-clause:
PHP Code:

if($foruminfo[forumid]==x$sortfield='title';
  elseif(
$foruminfo[forumid]==y$sortfield='rating';
  else 
$sortfield='lastpost'


Sho 08-18-2002 01:26 PM

Thanks Xenon!

memobug 08-18-2002 04:59 PM

This is great, Thanks!

Catherine 08-20-2002 07:07 PM

Xenon, I can't find the string of characters:
$sortfield ='lastpost' in the template forumdisplay.
What is the exact name of the template I need to look for.

I am only interested for the time being by having the Thread display in the order: first created, first in the list.

I totally agree with Memobug. We should have the choice of orders'criterias in the Admin options.

Thanks for your help!

Xenon 08-20-2002 07:37 PM

Catherine you should read more carefully:
i said forumdisplay.php not the forumdisplay template

Catherine 08-20-2002 08:29 PM

Xenon,

Sorry for my stupid question but I am not a Java script specialist and am just trying to hack some of my templates based on my knowledge of other programming languages.
So where can I find forumdisplay.php?

Thank you to let me know.

Sho 08-20-2002 08:40 PM

Catherine, forumdisplay.php is written in the PHP scripting language, not in JavaScript. You will find forumdisplay.php in the root directory of your vBulletin installation.

Catherine 08-20-2002 09:14 PM

Thank you!

butty 10-08-2002 11:52 PM

hi there, thanks very much for this tip its something that i have needed on my board for a while and didnt know it existed hat off 2 ya :)

only thing is could someone tell me how to change it so that the forum i am displaying by thread title so that it is sorted in ascending order aswel?

heres what i have at the moment in my forumdisplay.php file


PHP Code:


if($foruminfo[forumid]==17$sortfield='title';
  else 
$sortfield='lastpost'


many thanks in advance

Xenon 10-09-2002 09:45 AM

just change it to:
PHP Code:

if($foruminfo[forumid]==17) {
  
$sortfield='title';
  
$sortorder='';
}  else 
$sortfield='lastpost'

but if you have this, you won't be able to change the sortorder for this forum anymore without changing it in the php-file

butty 10-09-2002 01:58 PM

hi there mate thanks very much for your help. Ive changed it but it doesnt seem to have taken effect - heres what my forumdisplay.php looks like

PHP Code:


default:
if(
$foruminfo[forumid]==17) {
  
$sortfield='title';
  
$sortorder='';
}  else 
$sortfield='lastpost';


you can see the forum its supposed to be working on here and as you can see it still says descending wherease i would like it to be ascending

many thanks :)

Xenon 10-09-2002 02:15 PM

hmm, it should work, be sure it's below this block:
if ($sortorder!='asc') {
$sqlsortorder='DESC';
$order['desc']='selected';
} else {
$sqlsortorder='';
$order['asc']='selected';
}

have you uploaded the correct file?

butty 10-09-2002 02:24 PM

yeah definetly mate triple checked that and its underneath that block heres what more if it looks like..........


PHP Code:


if ($sortorder!='asc') {
  
$sqlsortorder='DESC';
  
$order['desc']='selected';
} else {
  
$sqlsortorder='';
  
$order['asc']='selected';
}
switch (
$sortfield) {
  case 
'title':
  case 
'lastpost':
  case 
'replycount':
  case 
'views':
  case 
'postusername':
  case 
'voteavg':
    break;

default:
if(
$foruminfo[forumid]==17) {
  
$sortfield='title';
  
$sortorder='';
}  else 
$sortfield='lastpost';
}
if (
$sortfield=="voteavg" and !$foruminfo[allowratings]) {
  
$sortfield="lastpost";
}

$sort = array();
$sort[$sortfield]='selected'


Xenon 10-09-2002 09:40 PM

looool, damn sorry was my fault

change $sortorder=''; into $sqlsortorder='';

TundraSoul 10-18-2002 07:17 AM

Would it be possible to get a hack, which allows the user to set the thread order (forward or reverse) from the user control panel?

No matter what way I set it, half the group always wants it the other way.

Thanks!

TundraSoul 11-05-2002 04:26 AM

^bump

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

Robert9 08-19-2006 11:09 PM

May you have an idea, too, how to sort different on forum home?
Say we have two style-ids; with it we could make a decision, with style-id 1 we would have sort as usual, with style-id we have another one.
The problem with this, i dont have a sort criteria. I only want to set up to forums to the top, that be at the end normaly (without changing the other ones).


All times are GMT. The time now is 09:11 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.01407 seconds
  • Memory Usage 1,848KB
  • 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
  • (9)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (31)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