Skip to:
Content

BuddyPress.org

Changeset 5764


Ignore:
Timestamp:
02/13/2012 08:31:40 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Allow non-group members to see the 'request-membership' page. Fixes #3687. Props r-a-y.

File:
1 edited

Legend:

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

    r5758 r5764  
    175175        if ( bp_is_groups_component() && !empty( $this->current_group ) ) {
    176176            if ( !$this->current_group->user_has_access ) {
     177
     178                // Hidden groups should return a 404 for non-members.
     179                // Unset the current group so that you're not redirected
     180                // to the default group tab
    177181                if ( 'hidden' == $this->current_group->status ) {
    178                     // Hidden groups should return a 404 for non-members.
    179                     // Unset the current group so that you're not redirected
    180                     // to the default group tab
    181182                    $this->current_group = 0;
    182183                    $bp->is_single_item  = false;
    183184                    bp_do_404();
    184185                    return;
    185                 } elseif ( !bp_is_current_action( 'home' ) ) {
     186
     187                // Skip the no_access check on home and membership request pages
     188                } elseif ( !bp_is_current_action( 'home' ) && !bp_is_current_action( 'request-membership' ) ) {
     189
     190                    // Off-limits to this user. Throw an error and redirect to the group's home page
    186191                    if ( is_user_logged_in() ) {
    187                         // Off-limits to this user. Throw an error and redirect to the group's home page
    188192                        bp_core_no_access( array(
    189193                            'message'  => __( 'You do not have access to this group.', 'buddypress' ),
     
    191195                            'redirect' => false
    192196                        ) );
     197
     198                    // User does not have access, and does not get a message
    193199                    } else {
    194                         // Allow the user to log in
    195200                        bp_core_no_access();
    196201                    }
Note: See TracChangeset for help on using the changeset viewer.