diff --git a/src/includes/forums/functions.php b/src/includes/forums/functions.php
index fa54e9d8..91036b79 100644
|
a
|
b
|
function bbp_update_forum_last_topic_id( $forum_id = 0, $topic_id = 0 ) { |
| 1611 | 1611 | // Loop through children and add together forum reply counts |
| 1612 | 1612 | $children = bbp_forum_query_subforum_ids( $forum_id ); |
| 1613 | 1613 | if ( ! empty( $children ) ) { |
| | 1614 | |
| | 1615 | // We want to record the last active time. |
| | 1616 | $latest_last_active = PHP_INT_MIN; |
| | 1617 | |
| 1614 | 1618 | foreach ( $children as $child ) { |
| 1615 | | $children_last_topic = bbp_update_forum_last_topic_id( $child ); // Recursive |
| | 1619 | $child_last_topic = bbp_update_forum_last_topic_id( $child ); // Recursive. |
| | 1620 | |
| | 1621 | // If the response is invalid. |
| | 1622 | if(!empty($child_last_topic)) { |
| | 1623 | // We need to get the last active time, because we need to compare them. |
| | 1624 | $child_last_active = bbp_get_topic_last_active_time($child_last_topic); |
| | 1625 | |
| | 1626 | // Update the last topic only if it is later. |
| | 1627 | if($child_last_active > $latest_last_active) { |
| | 1628 | $latest_last_active = $child_last_active; |
| | 1629 | $children_last_topic = $child_last_topic; |
| | 1630 | } |
| | 1631 | } |
| 1616 | 1632 | } |
| 1617 | 1633 | } |
| 1618 | 1634 | |