Ok, the solution is a bit silly, but gets the job done. There's no trigger for directly handling the array of tabs. Instead we need to remove the tabs HTML from the return response which would be the display of the group. The below will do this. It will remove every tab except the About tab if the viewing user is not a member of the group and is not a CB Moderator.
Global
Triggers: gj_onAfterDisplayGroup
Type: Code
User: Self
Access: All Non-Moderators
Action
Method: PHP
Code:
Code:
if ( ! in_array( $variables['var2']->getInt( 'type', 0 ), [ 2, 5 ], true ) ) {
// the group isn't an invite or approval group so skip removing tabs
return;
}
if ( $user->getInt( 'id', 0 ) === $variables['var2']->getInt( 'user_id', 0 ) ) {
// viewing user is the owner of the group so skip removing tabs
return;
}
if ( \CB\Plugin\GroupJive\CBGroupJive::getGroupStatus( $user, $variables['var2'] ) >= 1 ) {
// viewing user is an active member of the group so skip removing tabs
return;
}
// run some regexp to remove the tabs original html before it has been processed by javascript from the output buffer
$variables['var1'] = preg_replace( '%<div class="cbTabPane tab-pane cbTabPaneMenu" id="cbtabpanegrouptab(?:activity|wall|photo|video|file|events|users)"><h2 class="cbTabNav cbNavBarItem nav-item" id="cbtabnavgrouptab(?:activity|wall|photo|video|file|events|users)"><a href="#cbtabpanegrouptab(?:activity|wall|photo|video|file|events|users)" class="cbTabNavLink cbNavBarLink nav-link">.+</a></h2><div class="cb_tab_content cb_tab_menu" id="cb_tabid_grouptab(?:activity|wall|photo|video|file|events|users)">.+</div></div>%is', '', $variables['var1'] );
Parameters
Reference Variables: Variable 1
I've tested the above and confirmed it works. This will also only apply to Approval and Invite group types. All other types are left alone. I've added comments for reach step so its a little understood what's going on in the code. Note this can result in groups basically having an empty tab bar if the group didn't supply any About content.