Skip to:
Content

BuddyPress.org

Ticket #4785: access_exemption_1.patch

File access_exemption_1.patch, 1.2 KB (added by dcavins, 10 years ago)

Adds a filter to allow publicly visible panes in private groups.

  • bp-groups/bp-groups-loader.php

    diff --git bp-groups/bp-groups-loader.php bp-groups/bp-groups-loader.php
    index 4a0b188..223708c 100644
    class BP_Groups_Component extends BP_Component { 
    268268
    269269                                // Skip the no_access check on home and membership request pages
    270270                                } 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() ) {
     271                                       
     272                                        //Check for access exemptions requested by plugins
     273                                        $access_exemption = apply_filters( 'bp_groups_access_exemption', false );
     274
     275                                        if ( $access_exemption ) {
     276                                                // If a plugin author has specifically allowed access to this pane, allow it.
     277                                                // Do nothing; prevents bp_core_no_access from acting.
     278                                        } elseif ( is_user_logged_in() ) {
     279                                                // Off-limits to this user. Throw an error and redirect to the group's home page
    274280                                                bp_core_no_access( array(
    275281                                                        'message'  => __( 'You do not have access to this group.', 'buddypress' ),
    276282                                                        'root'     => bp_get_group_permalink( $bp->groups->current_group ) . 'home/',