Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-09-18 02:29:25

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Sorting articles by last comment published

Is there any way to list articles not by the number of comments but by the posted date of comments?

Even using some PHP magic…

Thanks,

Loz

Offline

#2 2008-09-18 15:23:22

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Sorting articles by last comment published

I think Lawrence wants to sort the articles, not the comments… :)

Offline

#3 2008-09-18 18:54:16

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Sorting articles by last comment published

Thanks for pointing that out (I’ve deleted my earlier post).

Lawrence, it’s not impossible, but the comments and articles are stored in separate tables in the database (textpattern and txp_discuss). If you want to sort the article (textpattern table) based on information stored in the comments table (txp_discuss), you’d have to manually query the database using a SQL JOIN between those tables, grouping it by article ID and sorting on the MAX value of the column in txp_discuss that contains the posted date.

Perhaps the smd_query plugin can help you do this (although I haven’t tried it yet myself).

Offline

#4 2008-09-20 13:03:02

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: Sorting articles by last comment published

Hi,

Thanks for the feedback.

Sounds like more of a hassle than anything.

Alternatively there is wet_recent_comments, but I am using that already (and modified for formatting purposes).

Is there a way to run two of the same plugins?

Offline

Board footer

Powered by FluxBB