Forum Discussion

sunny_mody's avatar
sunny_mody
Advisor
11 years ago

Recent topics does not change if edited

Hi,

t po

I am using /topics/style/forum/recent api to get the list of recent topics,

 

but if I edit any topic it does not sort by last edited.

 

Is there a way to get recent topics sorted by last edited time?

 

Thanks,

Sunny

 

  • sunny_mody - Yes, you can sort the topics using following snippet

     

    <#assign topics = rest("/topics/style/forum/recent?restapi.response_style=view").messages />
            <#list topics.message?sort_by(["last_edit_time"])?reverse as sorted_topics>
    	      ${sorted_topics.board_id} (${sorted_topics.last_edit_time.@view_date} ${sorted_topics.last_edit_time.@view_time})<br>
            </#list>

     The code highlighted in blue would sort it for you. Let me know if this helps.

    • RafaelC's avatar
      RafaelC
      Khoros Alumni (Retired)

      A word of caution about the proposed solution in the code snippet above. Using that approach will lead to the performance issues since the sorting is being made programmatically and NOT via the API. 

      As far as I know, it is NOT currently possible to sort topics by last edit time either with REST API v1 or v2.

      /rafa