PDA

View Full Version : change thread sort order?


bluestartech
12-29-2009, 03:24 PM
We have one specific thread that I would like to change the sort order on from descending to ascending. I can change the Default Sort Order of that specific forum, however it does not affect the thread within it.

Is this something that can be done?

we_are_borg
12-29-2009, 07:06 PM
Would be nice if you say what version you use vb3.x and vb4 are very different.

vbenhancer
12-29-2009, 07:54 PM
actually no, there is no difference whatsoever in the plugin to create for any version of vBulletin...

hook: showthread_getinfo

if($threadid == 'XXX') $postorder = 'ASC'; # or 'DESC' depending on your needs


the logic behind the "no postorder" is that you usually start reading a thread when it started, and when you click the icon "go to last unread post", you are redirected where you were last time... if you force the order, the button will work, but it will require you to scroll back...

bluestartech
12-30-2009, 02:06 PM
Excuse my lack of knowledge in this respects. I would like to make it into a plugin like this, but I do not know how to implement the php code section..

<?xml version="1.0" encoding="ISO-8859-1"?>
<plugins>
<plugin active="1">
<title>Reverse Thread Sorting</title>
<hookname>showthread_getinfo</hookname>
<phpcode><![CDATA[$this->validfields['forumhomeicon'] = array(TYPE_STR, REQ_NO);]]></phpcode>
</plugin>
</plugins>

if($threadid == '35') $postorder = 'ASC';

And then do I have call the hook in another file or will it work as an option automatically?

Thank you

Lynne
12-30-2009, 02:17 PM
Why are you doing it in xml? Just go to Plugins & Products and select Add New Plugin and add it there. If you later want to export it, you export it from the Download /Upload Plugins page.

bluestartech
12-30-2009, 03:01 PM
ohh ok. Thank you Lynne.

Now that I have it as a plugin, how do I use it on that thread? or should thread 35 automatically reverse the sort order? I dont see any new menu options or the order being reversed.

Lynne
12-30-2009, 04:11 PM
You don't get any 'options' because you didn't add any. You may have to use $thread['threadid'] or $threadinfo['threadid'] instead of $threadid.

bluestartech
12-30-2009, 04:25 PM
I have tried the following and none worked.

if($threadid == '35') $postorder = 'ASC';

if($thread['35']) $postorder = 'ASC';

if($threadinfo['35']) $postorder = 'ASC';

Lynne
12-30-2009, 04:29 PM
That's not what I said to do. I said put in $thread['threadid'] or $threadinfo['threadid'] instead of $threadid. Exactly. I didn't say change 'threadid' to the actual threadid.

bluestartech
12-30-2009, 04:38 PM
Well thank you for pointing that out. I do not want all threads to be changed, just the specific one.

Lynne
12-30-2009, 05:13 PM
I know, so you check it like this (or it may be $threadinfor['threadid'], like I was saying):

if($thread['threadid'] == 35) $postorder = 'ASC';

bluestartech
12-30-2009, 05:53 PM
I understand now. Thank you for explaining. I tried both
if($thread['threadid'] == 35) $postorder = 'ASC';

and

if($threadinfo['threadid'] == 35) $postorder = 'ASC';

saved + reload but no change in the thread 35 sort order...

Lynne
12-30-2009, 07:26 PM
LOL. Actually, the problem is that you want DESC, not ASC. Change that.

bluestartech
12-30-2009, 07:37 PM
woo thank you..
if($thread['threadid'] == 35) $postorder = 'DESC';


did the trick