PDA

View Full Version : How do I make posts in certain threads appear in reverse order ?


Marcel Lee
11-09-2006, 01:40 PM
I want to make it so that the posts in certain threads appear in reverse order; in that new posts would appear at the beginning instead of the end of the thread.

I'm thinking it should be a matter of simply using a "if/then" statement for those particular threadids, making a special forum where threads go like that by default or something, but I dont know.

Analogpoint
11-17-2007, 05:22 PM
Create a new forum and set the Default sort field to Thread start time, and the Default sort order to Ascending.

Marcel Lee
11-17-2007, 07:34 PM
I just tried that and it doesn't work.

What I want to do is make it so that the posts in certain threads appear in reverse order, the way they do when you change the Thread Display Mode to Newest First on the Edit Options page in your User CP.


Do I have to wait till November 2008 for another reply??

Analogpoint
11-19-2007, 08:04 PM
I'm sorry I mis-read. The instructions I gave would be for threads in a forum, not posts in a thread.

A plugin on the showthread_getinfo hook with the following code should do the job.

if ($threadinfo['threadid'] == 123)
{
$postorder = 'DESC';
}

Marcel Lee
11-20-2007, 04:19 PM
Wow, it worked! Thanks. :D

Now I just need to know how to do it for several threads, instead of just one. I tried separating the thread id numbers by commas and got an error. I also separated them by spaces and got an error. Should I just paste the entire code again and again for every one?

I'm eventually going to do it for hundreds of threads, so let me know the best way to go about it.

Analogpoint
11-20-2007, 04:39 PM
Just change the code to this: You can add as many threadids as you want, separated by commas.

if (in_array($threadinfo['threadid'], array(32, 45, 678, 234, 987, 456, 21))
{
$postorder = 'DESC';
}

You could also create a full mod that would allow you to set a thread to show in this order when you create it, but that would be more involved.