diff --git bp-groups/bp-groups-loader.php bp-groups/bp-groups-loader.php
index 4a0b188..87461be 100644
|
|
class BP_Groups_Component extends BP_Component { |
266 | 266 | bp_do_404(); |
267 | 267 | return; |
268 | 268 | |
269 | | // Skip the no_access check on home and membership request pages |
270 | | } elseif ( !bp_is_current_action( 'home' ) && !bp_is_current_action( 'request-membership' ) ) { |
271 | | |
272 | | // Off-limits to this user. Throw an error and redirect to the group's home page |
273 | | if ( is_user_logged_in() ) { |
| 269 | } else { |
| 270 | |
| 271 | // Skip the no_access check on home and membership request pages. Also check for access exemptions requested by plugins. See @bp_groups_always_visible_tabs() for how to filter this value. |
| 272 | $access_exemption = apply_filters( 'bp_groups_access_exemption', false ); |
| 273 | |
| 274 | if ( $access_exemption ) { |
| 275 | // Do nothing; prevents bp_core_no_access from acting. |
| 276 | } elseif ( is_user_logged_in() ) { |
| 277 | // Off-limits to this user. Throw an error and redirect to the group's home page |
274 | 278 | bp_core_no_access( array( |
275 | 279 | 'message' => __( 'You do not have access to this group.', 'buddypress' ), |
276 | 280 | 'root' => bp_get_group_permalink( $bp->groups->current_group ) . 'home/', |
… |
… |
function bp_setup_groups() { |
605 | 609 | buddypress()->groups = new BP_Groups_Component(); |
606 | 610 | } |
607 | 611 | add_action( 'bp_setup_components', 'bp_setup_groups', 6 ); |
| 612 | |
| 613 | function bp_groups_always_visible_tabs( $setting ) { |
| 614 | // Skip the no_access check on home and membership request pages. Must return $setting if not acting. |
| 615 | if ( bp_is_current_action( 'request-membership' ) || bp_is_current_action( 'home' ) ) { |
| 616 | return true; |
| 617 | } else { |
| 618 | return $setting; |
| 619 | } |
| 620 | } |
| 621 | add_filter( 'bp_groups_access_exemption', 'bp_groups_always_visible_tabs', 11 ); |
| 622 | No newline at end of file |