Thanks for the pointer on that, I was able to find that component and the section on lazyloadmessages as below. My objective is to change the dropdown sort options on the message list for the Home page, Category Page and Board Pages so that in addition to the current option we have named 'Most Recent' sort which uses post_time there should be an option to sort by 'Most Recent Reply' which I believe should use the last_post_time. The chronological view by post date means that posts that happened in the past and are no longer at the top of the feed are not easily findable/visible to viewers especially when they have a lot of activity. What's the best way to add an additional sort option to allow sorting by 'Most Recent Reply'? <#-- lazy load messages -->
<#function getLazyLoadMessages nodeId messageListType pageSize scope offset allowedInteractionStyles="">
<#local selectFields = "id, tags, labels, conversation.solved, conversation.last_post_time, conversation.last_post_time_friendly, user_context.read, images, board.id, board.title, board.view_href, teaser, body, post_time_friendly, subject, author.login, author.view_href, author.avatar.profile, author.rank.name, author.rank.color, author.rank.bold, post_time, view_href, kudos.sum(weight), replies.count(*), metrics.views, conversation.solved" />
<#local conversationClause = messageUtils.getConversationClause(allowedInteractionStyles) />
<#local where = " WHERE depth=0 " + conversationClause />
<#if scope == "category">
<#local where = where + " AND category.id='${nodeId}' " />
<#local orderLastPost = (restadmin("/categories/id/${nodeId}/settings/name/layout.sort_view_by_last_post_date").value)!"false" />
<#elseif scope == "board">
<#local where = where + " AND board.id='${nodeId}' " />
<#local orderLastPost = (restadmin("/boards/id/${nodeId}/settings/name/layout.sort_view_by_last_post_date").value)!"false" />
<#else>
<#local orderLastPost = settings.name.get("layout.sort_view_by_last_post_date", "false") />
</#if>
<#if messageListType == 'recent'>
<#if orderLastPost == "true">
<#local orderClause = " ORDER BY conversation.last_post_time DESC LIMIT " + pageSize + " offset " + offset/>
<#else>
<#local orderClause = " ORDER BY post_time DESC LIMIT " + pageSize + " offset " + offset />
</#if>
<#elseif messageListType == "topkudos">
<#local orderClause = " ORDER BY kudos.sum(weight) DESC LIMIT " + pageSize + " offset " + offset />
<#elseif messageListType == "views">
<#local orderClause = " ORDER BY metrics.views DESC LIMIT " + pageSize + " offset " + offset />
<#elseif messageListType == "replies">
<#local orderClause = " ORDER BY replies.count(*) DESC LIMIT " + pageSize + " offset " + offset />
<#else>
<#local orderClause = "" />
</#if>
<#local msgQry = "SELECT ${selectFields} FROM messages ${where} ${orderClause}" />
<#local msgRes = commonUtils.executeLiQLQuery(msgQry) />
<#return msgRes />
</#function>
<#--/lazy load messages -->
... View more