Skip to:
Content

bbPress.org

Ticket #3637: fix.patch

File fix.patch, 1.2 KB (added by terresquall, 13 months ago)

Patch file for the fix.

  • src/includes/forums/functions.php

    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 ) { 
    16111611                // Loop through children and add together forum reply counts
    16121612                $children = bbp_forum_query_subforum_ids( $forum_id );
    16131613                if ( ! empty( $children ) ) {
     1614                       
     1615                        // We want to record the last active time.
     1616                        $latest_last_active = PHP_INT_MIN;
     1617                       
    16141618                        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                                }
    16161632                        }
    16171633                }
    16181634