Log in

View Full Version : Alpha sort by thread title of one forum


Andy
08-19-2005, 01:00 AM
I would like to be able to have just one forum be alpha sorted by the thread name as opposed to the deafult last post time.

A plug in for this would be great. Thank you :)

darnoldy
08-19-2005, 01:21 AM
Andy-

Try this:

Find the forumbit template that calls the forum on your forumhome (this will vary depending on your forum hierarchy).

In that template, Find:
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
<strong>$forum[title]</strong>
</a>


Change it to:
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]<if condition="$forum[forumid] = ##">&order=asc&sort=title</if>">
<strong>$forum[title]</strong>
</a>
Replace the ## in the above code with the ID number of the forum you want to affect.


This should cause that forum to be displayed in ascii order by title.

--don

Andreas
08-19-2005, 01:51 AM
Alternatively you could use https://vborg.vbsupport.ru/showthread.php?t=93074

Andy
08-19-2005, 05:03 AM
Hi darnoldy,

Thank you for your help. Your example works almost perfect. First I had to change the "=" to "==".

The problem with the your solution is if a user makes a post in the thread or clicks on the bread crumb, the alpha sorting is lost.

I ended up modifying the forumdisplay.php as follows. This works perfect.



Find:

if ($vbulletin->GPC['sortorder'] != 'asc')

REPLACE it with:

if ($vbulletin->GPC['sortorder'] != 'asc' AND $foruminfo['forumid'] != 'XX')


Find:

$sqlsortfield = 'lastpost';
$sortfield = 'lastpost';

REPLACE it with:

if ($foruminfo['forumid'] == 'XX'):
$sqlsortfield = 'thread.title';
$sortfield = 'thread.title';
else:
$sqlsortfield = 'lastpost';
$sortfield = 'lastpost';
endif;

Boofo
08-19-2005, 05:28 AM
Andy, you should use Kirby's hack for that. That way you can change it for whatever forum you want to and not have to touch any php files. ;)

darnoldy
08-19-2005, 05:43 AM
Your example works almost perfect. First I had to change the "=" to "==".Oops, sorry about the typo.

The problem with the your solution is if a user makes a post in the thread or clicks on the bread crumb, the alpha sorting is lost.Yeh, that would be a problem.

I ended up modifying the forumdisplay.php Glad you solved it

--don

Andy
08-19-2005, 06:15 AM
Andy, you should use Kirby's hack for that. That way you can change it for whatever forum you want to and not have to touch any php files. ;)

I appreciate the suggestion. I have yet to install any hacks. For example with Kirby's hack here is what is modified;

1 Product XML with 2 Queries, 9 Plugins, 15 Phrases and 2 Settings 4 Template Edits

I only needed to add a few lines to the php file. I always prefer a simple solution to one that changes a lot of things.

Boofo
08-19-2005, 06:38 AM
But with the hack, this is now an option in each forum and there is no direct editing of php files so upgrading vb will be a snap and you would not have to re-edit the file or re-install the hack. The product system really is remarkable.

Andreas
08-19-2005, 11:38 AM
@Andy
If you just want to set the Default in Admin CP and don't need/want a UserCP Option and Thread Start Date, you would just have to import the XML of my Hack - that's it (no Template Edits).