Is it Possible to Get the Current Group ID While in the Loop? (Continued because BP Forum Will Not L
-
Out-of-the-box, BP has a Send Invites link on the Groups forum. We don’t want that link unless you are a Group Admin or Group Moderator. Currently, we only have 1 private group set at this time with a group moderator. It is Group 17. But I know we will be getting more and more of these instances and I want to avoid hard coding the Groups each time to control the Send Invites link.
See my code below from a plug-in I wrote:
My plug-in:
`
function bbg_remove_send_invites_from_group() {if ($_SERVER == ‘123.456.789.10’) { // my test — does not work
global $bp;
$guid = $bp->group->id;
echo ‘>>’.$guid.'<>’.bp_group_id().'<<';
exit;
}//bp_core_remove_nav_item( bp_get_current_group_slug(), ‘send-invites’ );
$guid = ’17’; //Group ID for Bob’s Private Group
if (is_site_admin()) return;
elseif (groups_is_user_mod( get_current_user_id(), $guid ) == “1”) return;
elseif (groups_is_user_admin( get_current_user_id(), $guid ) == “1”) return;
else bp_core_remove_subnav_item( bp_get_current_group_slug(), ‘send-invites’ );
}add_action( ‘bp_setup_nav’, ‘bbg_remove_send_invites_from_group’ );
`
- The topic ‘Is it Possible to Get the Current Group ID While in the Loop? (Continued because BP Forum Will Not L’ is closed to new replies.