<th><?php _e('Main Theme'); ?> </th> <th><?php _e('Topics'); ?> </th> <th><?php _e('Posts'); ?> </th> </tr> <?php while (bb_forum()) { if (bb_get_forum_is_category()) { ?> <tr<?php bb_forum_class('bb-category'); ?> > <td colspan="3"><?php bb_forum_pad('<div class="nest">'); ?> <a href="<?php forum_link(); ?> "><?php forum_name(); ?>
function bb_get_forum_dropdown($args = '') { $defaults = array('callback' => false, 'callback_args' => false, 'id' => 'forum_id', 'none' => false, 'selected' => false, 'tab' => false, 'hierarchical' => 1, 'depth' => 0, 'child_of' => 0, 'disable_categories' => 1, 'options_only' => false); if ($args && is_string($args) && false === strpos($args, '=')) { $args = array('callback' => $args); } if (1 < func_num_args()) { $args['callback_args'] = func_get_arg(1); } $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); if (!bb_forums($args)) { return; } global $forum_id, $forum; $old_global = $forum; $name = esc_attr($id); $id = str_replace('_', '-', $name); $tab = (int) $tab; if ($none && 1 == $none) { $none = __('- None -'); } $r = ''; if (!$options_only) { if ($tab) { $tab = ' tabindex="' . $tab . '"'; } else { $tab = ''; } $r .= '<select name="' . $name . '" id="' . $id . '"' . $tab . '">' . "\n"; } if ($none) { $r .= "\n" . '<option value="0">' . $none . '</option>' . "\n"; } $no_option_selected = true; $options = array(); while ($depth = bb_forum()) { global $forum; // Globals + References = Pain $pad_left = str_repeat(' ', $depth - 1); if ($disable_categories && isset($forum->forum_is_category) && $forum->forum_is_category) { $options[] = array('value' => 0, 'display' => $pad_left . $forum->forum_name, 'disabled' => true, 'selected' => false); continue; } $_selected = false; if (!$selected && $forum_id == $forum->forum_id || $selected == $forum->forum_id) { $_selected = true; $no_option_selected = false; } $options[] = array('value' => $forum->forum_id, 'display' => $pad_left . $forum->forum_name, 'disabled' => false, 'selected' => $_selected); } if (1 === count($options) && !$none) { foreach ($options as $option_index => $option_value) { if ($option_value['disabled']) { return; } return '<input type="hidden" name="' . $name . '" id="' . $id . '" value="' . esc_attr($option_value['value']) . '" /><span>' . esc_html($option_value['display']) . '</span>'; } } foreach ($options as $option_index => $option_value) { if (!$none && !$selected && $no_option_selected && !$option_value['disabled']) { $option_value['selected'] = true; $no_option_selected = false; } $option_disabled = $option_value['disabled'] ? ' disabled="disabled"' : ''; $option_selected = $option_value['selected'] ? ' selected="selected"' : ''; $r .= "\n" . '<option value="' . esc_attr($option_value['value']) . '"' . $option_disabled . $option_selected . '>' . esc_html($option_value['display']) . '</option>' . "\n"; } $forum = $old_global; if (!$options_only) { $r .= '</select>' . "\n"; } return $r; }