• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

how to sort threads alphabetically ?

erich37

Well-known member
#5
I mean sorting it permanently as Admin, as I want to create a few hundred threads, I would like to sort them somehow, either alphabetically or somehow else....
 

erich37

Well-known member
#7
Hi Jake,

not sure what is the code to have all threads in a specific forum sorted ALPHABETICALLY in ascending order ?

I also think this should be an option as per XF-default.....probably a suggestion for Kier & Mike....
 

Jake Bunce

XenForo moderator
Staff member
#8
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:
			<xen:if is="{$forum.node_id} == 2">
				<h3 class="nodeTitle"><a href="{xen:link forums, $forum, 'order=title', 'direction=asc'}" 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>
Change the number 2 to the node_id of the specific forum you want to sort.

This works by changing the link for the specified forum to include the sort parameters. It isn't a proper default option like you want, but it should work for your purposes.
 

Saeed

Well-known member
#9
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:
<xen:if is="{$forum.node_id} == 2">
<h3 class="nodeTitle"><a href="{xen:link forums, $forum, 'order=title', 'direction=asc'}" 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>
Change the number 2 to the node_id of the specific forum you want to sort.

This works by changing the link for the specified forum to include the sort parameters. It isn't a proper default option like you want, but it should work for your purposes.
Thank you for posting this, Jake. I want to do exactly the same, i.e. in the view listing all threads in a particular forum, I would like the threads to be listed alphabetically by thread title.

However, this code doesn't seem to work. I have made sure that I changed the node_id to the desired forum, but with no effect. Has the code changed since last posted perhaps? :)
 

Jake Bunce

XenForo moderator
Staff member
#10
The link should contain "order=title" after editing that template. If it doesn't then be sure you are clicking the forum's link in the node listing as that is the only place where that parameter will be included.
 

gldtn

Well-known member
#11
The link should contain "order=title" after editing that template. If it doesn't then be sure you are clicking the forum's link in the node listing as that is the only place where that parameter will be included.
So, if we go directly to the node link without clicking on it through the forum list it won't be ordered correct?

how would I do the same within a page?