REQUEST
We would like an option to display activity comments newest-first, on both the web and the app.
WHY THIS MATTERS
Our community is Japanese and many activity posts accumulate dozens of comments over months. Because comments are always returned oldest-first and the feed only shows the first few, members see comments from a year ago and must repeatedly tap "load more" to reach current conversation. On one of our posts the first comments shown are from 2025-08-28 while the newest is from 2026-06-23. This actively discourages members from participating in recent discussion.
WHAT WE FOUND IN THE CODE
1. There is no setting for comment order. The ORDER BY is hardcoded as "ORDER BY a.date_recorded ASC" in BP_Activity_Activity::get_activity_comments() (both the legacy and the current query branches).
2. You already appear to have laid groundwork for descending order: the filter bb_activity_recurse_comments_order_by exists and, when it returns DESC, the pagination comparison operators are correctly inverted. But the ORDER BY itself cannot follow, so the filter alone cannot produce newest-first.
3. Simply forcing DESC breaks threading. The tree assembly loop attaches a comment to its parent only if the parent has already been seen; otherwise the comment is promoted to root level. With DESC, replies arrive before their parents. We measured this on our production data for one activity:
- ASC (current): 17 root comments, 53 total, max depth 4 (correct)
- DESC (forced): 53 root comments, 53 total, max depth 1 (all 36 replies flattened to root)
SUGGESTED FIX
Making the tree assembly order-independent would be a small, low-risk change and would unlock descending order safely: build the reference index in a first pass over all fetched comments, then attach children to parents in a second pass. Order then no longer matters, and bb_activity_recurse_comments_order_by could drive the ORDER BY directly.
With that in place, a site setting such as "Comment order: Oldest first / Newest first" (mirroring the existing activity sorting options) would serve both the web and the app, since both go through get_activity_comments().
In the meantime we have implemented a workaround on our side (descending only in the top-level-only query mode, plus a post-assembly reorder elsewhere), but we would much prefer this to be native so we can remove our custom code.
Thank you.