public static function joinRecentChildPosts(&$Category = null, &$Categories = null) { if ($Categories === null) { $Categories =& self::$Categories; } if ($Category === null) { $Category =& $Categories[-1]; } if (!isset($Category['ChildIDs'])) { return; } $LastTimestamp = Gdn_Format::toTimestamp($Category['LastDateInserted']); $LastCategoryID = null; if ($Category['DisplayAs'] == 'Categories') { // This is an overview category so grab it's recent data from it's children. foreach ($Category['ChildIDs'] as $CategoryID) { if (!isset($Categories[$CategoryID])) { continue; } $ChildCategory =& $Categories[$CategoryID]; if ($ChildCategory['DisplayAs'] == 'Categories') { self::JoinRecentChildPosts($ChildCategory, $Categories); } $Timestamp = Gdn_Format::toTimestamp($ChildCategory['LastDateInserted']); if ($LastTimestamp === false || $LastTimestamp < $Timestamp) { $LastTimestamp = $Timestamp; $LastCategoryID = $CategoryID; } } if ($LastCategoryID) { $LastCategory = $Categories[$LastCategoryID]; $Category['LastCommentID'] = $LastCategory['LastCommentID']; $Category['LastDiscussionID'] = $LastCategory['LastDiscussionID']; $Category['LastDateInserted'] = $LastCategory['LastDateInserted']; $Category['LastTitle'] = $LastCategory['LastTitle']; $Category['LastUserID'] = $LastCategory['LastUserID']; $Category['LastDiscussionUserID'] = $LastCategory['LastDiscussionUserID']; $Category['LastUrl'] = $LastCategory['LastUrl']; $Category['LastCategoryID'] = $LastCategory['CategoryID']; // $Category['LastName'] = $LastCategory['LastName']; // $Category['LastName'] = $LastCategory['LastName']; // $Category['LastEmail'] = $LastCategory['LastEmail']; // $Category['LastPhoto'] = $LastCategory['LastPhoto']; } } }