您可能应该首先尝试此插件:http://buddydev.com/buddypress/blog-categories-for-groups-plugin/
或者您可以从中提取一些代码,并尝试自己实现它。开始使用组的博客类别。php,并查看最后几行:
//for single post screen
function screen_group_blog_single_post(){
global $bp;
if(function_exists(\'bp_is_group\')&&!bp_is_group())
return;
//do not catch the request for creating new post
if(bp_is_action_variable(\'create\',0))
return;
$current_group=groups_get_current_group();
if(bcg_is_disabled($current_group->id))
return;
//if the group is private/hidden and user is not member, return
if(($current_group->status==\'private\'||$current_group->status==\'hidden\')&&(!is_user_logged_in()||!groups_is_user_member(bp_loggedin_user_id(), $current_group->id)))
return;//avoid prioivacy troubles
if (bp_is_groups_component() && bp_is_current_action(BCG_SLUG) &&!empty($bp->action_variables[0]) ){
$wpq=new WP_Query(bcg_get_query());
if($wpq->have_posts()){
//load template
bp_core_load_template( apply_filters( \'groups_template_group_blog_single_post\', \'bcg/home\' ) );
}
else
bp_core_add_message (__("Sorry, the post does not exists!","bcg"),"error");
}
}
另请参见:
http://buddypress.org/support/topic/how-to-exclude-a-group-from-the-groups-loop/