/** * * @global type $bp * @return type */ function bcg_is_disabled_for_group() { $bp = buddypress(); $group_id = false; if (bp_is_group_create()) { $group_id = $_COOKIE['bp_new_group_id']; } elseif (bp_is_group()) { $group_id = $bp->groups->current_group->id; } return apply_filters('bcg_is_disabled_for_group', bcg_is_disabled($group_id)); }
public function view_single() { $bp = buddypress(); 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 (bcg_is_component() && !empty($bp->action_variables[0])) { //should we check for the existence of the post? add_action('bp_template_content', array($this, 'get_single_post_contents')); } }