Default thread display order

xFalcon

Member
Hi guys,
In one of my sub forums, I want to set the default thread display order to be sorted by "Thread Creation Time", rather than the default "Last Message Time".

Now I know this can be changed when you are viewing the forum itself, by going to the little pop out menu at the bottom - but from what I understand this is setting it for me only. What if I want to make it the default for everyone?

Couldn't find any options for this. Thanks in advance for the replies guys..
 
There is no option for that. But you can fudge it with a template edit:

Admin CP -> Appearance -> Templates -> node_forum_level_2

Replace this code:

Code:
			<h3 class="nodeTitle"><a href="{xen:link forums, $forum}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a></h3>

...with this:

Code:
			<h3 class="nodeTitle"><a href="{xen:link forums, $forum, 'order=post_date'}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a></h3>

That will change the links in the forum list to include order=post_date.
 
That'll change all of my forums though won't it? I just want to do one... :)

I like conditionals.

Code:
			<xen:if is="{$forum.node_id} == 2">
				<h3 class="nodeTitle"><a href="{xen:link forums, $forum, 'order=post_date'}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a></h3>
			<xen:else />
				<h3 class="nodeTitle"><a href="{xen:link forums, $forum}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a></h3>
			</xen:if>

This will add the order parameter for only the forum specified (node_id 2 in the above code).
 
I figured it out, however, this does not work site wide. For example, a user clicking on the forum via the breadcrumb will not have the sort order changed.
 
Is there anyway to force this site wide so that when someone opens that forum, regardless of the way they find it (via search engine for example) that it sort by Title ASC?
 
I was looking for solution to same problem and came up with a different solution that doesn't require adding stuff to forum URL, but it requires changing php code a bit.

Open library/XenForo/ControllerPublic/Forum.php, find function _getDefaultThreadSort and replace contents with something like this:
Code:
    protected function _getDefaultThreadSort(array $forum)
    {
        if($forum['node_id'] == 51)
        {
            return array('post_date',  'desc');
        }
        return array('last_post_date',  'desc');
    }
 
I presume there would be a simple way to apply this to multiple nodes without having a dozen if statements?

Rich (BB code):
			<xen:if is="in_array({$forum.node_id}, array(1,2,3))">
				<h3 class="nodeTitle"><a href="{xen:link forums, $forum, 'order=post_date'}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a></h3>
			<xen:else />
				<h3 class="nodeTitle"><a href="{xen:link forums, $forum}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a></h3>
			</xen:if>
 
Top Bottom