buddydev / blog-categories-for-groups

BuddyPress Blog Categories for groups Plugin
http://buddydev.com/plugins/blog-categories-for-groups/
12 stars 6 forks source link

Allow selecting category In group #5

Open sbrajesh opened 13 years ago

sbrajesh commented 13 years ago

I think there is a missing feature to select a category in the group. I have added this function with a category dropdown in the bcg theme directory home.php. Just overwrite the div subnav with this one to make it work:

<div id="subnav" class="item-list-tabs no-ajax">

    <?php bcg_get_options_menu();
    $cats = bcg_get_categories(bp_get_group_id());
    $cats = implode(",", $cats);?>
    <select style="float:right;margin-right:20px;" name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
    <option value=""><?php echo attribute_escape(__('Kategorie')); ?></option>
    <?php
    $categories= get_categories('include='.$cats);
    foreach ($categories as $category) {
    $option = '<option value="'.bp_get_group_permalink().'blog/category/'.$category->term_id.'">';
    $option .= $category->cat_name;
    $option .= ' ('.$category->category_count.')';
    $option .= '</option>';
    echo $option;
    }
    ?>
    </select> 

</div>

reported by @ Sven