Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/15/2011 08:50:51 PM (14 years ago)
Author:
boonebgorges
Message:

Improves group access control for inner group pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-loader.php

    r4508 r4518  
    163163       
    164164        // Group access control
    165         if ( bp_is_groups_component() && !empty( $this->current_group ) && !$this->current_group->user_has_access ) {
    166             bp_core_no_access();
     165        if ( bp_is_groups_component() && !empty( $this->current_group ) && !empty( $bp->current_action ) && !$this->current_group->user_has_access ) {
     166            if ( is_user_logged_in() ) {
     167                // Off-limits to this user. Throw an error and redirect to the
     168                // group's home page           
     169                bp_core_no_access( array(
     170                    'message'   => __( 'You do not have access to this group.', 'buddypress' ),
     171                    'root'      => bp_get_group_permalink( $bp->groups->current_group ),
     172                    'redirect'  => false
     173                ) );
     174            } else {
     175                // Allow the user to log in
     176                bp_core_no_access();
     177            }
    167178        }
    168179
Note: See TracChangeset for help on using the changeset viewer.