Skip to:
Content

BuddyPress.org

Changeset 2954


Ignore:
Timestamp:
04/26/2010 11:43:08 PM (16 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2329 props boonebgorges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-groups.php

    r2933 r2954  
    11851185                return false;
    11861186
    1187         // user wants to join a group
     1187        // Skip if banned or already a member
    11881188        if ( !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) && !groups_is_user_banned( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
    1189                 if ( !groups_join_group($bp->groups->current_group->id) ) {
    1190                         bp_core_add_message( __('There was an error joining the group.', 'buddypress'), 'error' );
    1191                 } else {
    1192                         bp_core_add_message( __('You joined the group!', 'buddypress') );
    1193                 }
     1189
     1190                // User wants to join a group that is not public
     1191                if ( $bp->groups->current_group->status != 'public' ) {
     1192                        if ( !groups_check_user_has_invite( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
     1193                                bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' );
     1194                                bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     1195                        }
     1196                }
     1197
     1198                // User wants to join any group
     1199                if ( !groups_join_group( $bp->groups->current_group->id ) )
     1200                        bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' );
     1201                else
     1202                        bp_core_add_message( __( 'You joined the group!', 'buddypress' ) );
     1203
    11941204                bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
    11951205        }
Note: See TracChangeset for help on using the changeset viewer.