Reverse post order for a single thread (newsletter)

General Discussion
  • Hello,

    I have a thread where monthly project news are posted. The idea is to have the newest post on the top to avoid that users have to scroll over the old news. I know that is kind of opposite of what we do in a forum, but that is a special case 😉

    Is there a plugin or something to allow a reversed post order for a single thread ?

    Thanks.

  • I don't think there is one but you can write a plugin using the hook filter:router.page. This hook gets called before the actual topic route handler.

    In your plugin you can just do this:

    myPlugin.filterRouterPage = function (req, res, next) {
    	const myAnnouncementTopicId = 111;
    	if (req.params && req.params.topic_id && parseInt(req.params.topic_id, 10) === myAnnouncementTopicId) {
    		req.query.sort = 'newest_to_oldest';
    	}
    	next();
    };
    


Suggested Topics