Skip to content

Instantly share code, notes, and snippets.

@cs278
Created October 13, 2011 20:58
Show Gist options
  • Save cs278/1285505 to your computer and use it in GitHub Desktop.
Save cs278/1285505 to your computer and use it in GitHub Desktop.
Index: includes/functions_display.php
===================================================================
--- includes/functions_display.php (revision 10325)
+++ includes/functions_display.php (working copy)
@@ -222,9 +222,24 @@
$subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time'];
$subforums[$parent_id][$forum_id]['children'] = array();
- if (isset($subforums[$parent_id][$row['parent_id']]) && !$row['display_on_index'])
+ // Only grab this data if we actually display subforums
+ if ($forum_rows[$parent_id]['display_subforum_list'])
{
- $subforums[$parent_id][$row['parent_id']]['children'][] = $forum_id;
+ if (isset($subforums[$parent_id][$row['parent_id']]) && !$row['display_on_index'])
+ {
+ $subforums[$parent_id][$row['parent_id']]['children'][] = $forum_id;
+ }
+ else if (!$row['display_on_index'] && !empty($row['forum_parents']))
+ {
+ // Handle nested sub forums
+ foreach (unserialize($row['forum_parents']) as $sub_forum_parent_id => $void)
+ {
+ if (isset($subforums[$parent_id][$sub_forum_parent_id]))
+ {
+ $subforums[$parent_id][$sub_forum_parent_id]['children'][] = $forum_id;
+ }
+ }
+ }
}
if (!$forum_rows[$parent_id]['forum_id_unapproved_topics'] && $row['forum_id_unapproved_topics'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment