Changeset 5203
- Timestamp:
- 09/30/2011 10:38:56 PM (13 years ago)
- Location:
- branches/1.5/bp-groups
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/bp-groups/bp-groups-actions.php
r4961 r5203 244 244 // User wants to leave any group 245 245 if ( groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) { 246 if ( !groups_leave_group( $bp->groups->current_group->id ) ) { 246 247 // Stop sole admins from abandoning their group 248 $group_admins = groups_get_group_admins( $bp->groups->current_group->id ); 249 if ( 1 == count( $group_admins ) && $group_admins[0]->user_id == $bp->loggedin_user->id ) 250 bp_core_add_message( __( 'This group must have at least one admin', 'buddypress' ), 'error' ); 251 252 elseif ( !groups_leave_group( $bp->groups->current_group->id ) ) 247 253 bp_core_add_message( __( 'There was an error leaving the group.', 'buddypress' ), 'error' ); 248 } else {254 else 249 255 bp_core_add_message( __( 'You successfully left the group.', 'buddypress' ) ); 250 } 256 251 257 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) ); 252 258 } -
branches/1.5/bp-groups/bp-groups-screens.php
r5181 r5203 641 641 return false; 642 642 643 // Stop sole admins from abandoning their group 644 $group_admins = groups_get_group_admins( $bp->groups->current_group->id ); 645 if ( 1 == count( $group_admins ) && $group_admins[0]->user_id == $user_id ) 646 bp_core_add_message( __( 'This group must have at least one admin', 'buddypress' ), 'error' ); 647 643 648 // Demote a user. 644 if ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) )649 elseif ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) ) 645 650 bp_core_add_message( __( 'There was an error when demoting that user, please try again', 'buddypress' ), 'error' ); 646 651 else
Note: See TracChangeset
for help on using the changeset viewer.