Changeset 2538
- Timestamp:
- 02/02/2010 05:32:15 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups.php
r2537 r2538 211 211 if ( function_exists('friends_install') ) 212 212 bp_core_new_subnav_item( array( 'name' => __( 'Send Invites', 'buddypress' ), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $bp->groups->current_group->user_has_access ) ); 213 214 //bp_core_new_subnav_item( array( 'name' => __( 'Leave Group', 'buddypress' ), 'slug' => 'leave-group', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_leave', 'item_css_id' => 'eave', 'position' => 110, 'user_has_access' => $bp->groups->current_group->user_has_access ) );215 213 } 216 214 } … … 592 590 // Show send invite page 593 591 bp_core_load_template( apply_filters( 'groups_template_group_invite', 'groups/single/home' ) ); 594 }595 }596 }597 598 function groups_screen_group_leave() {599 global $bp;600 601 if ( $bp->is_single_item ) {602 if ( isset($bp->action_variables) && 'yes' == $bp->action_variables[0] ) {603 // Check if the user is the group admin first.604 if ( count( groups_get_group_admins( $bp->groups->current_group->id ) ) < 2 ) {605 if ( groups_is_user_admin( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {606 bp_core_add_message( __('As the only group administrator, you cannot leave this group.', 'buddypress'), 'error' );607 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );608 }609 }610 611 // remove the user from the group.612 if ( !groups_leave_group( $bp->groups->current_group->id ) ) {613 bp_core_add_message( __('There was an error leaving the group. Please try again.', 'buddypress'), 'error' );614 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );615 } else {616 bp_core_add_message( __('You left the group successfully.', 'buddypress') );617 bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug );618 }619 620 } else if ( isset($bp->action_variables) && 'no' == $bp->action_variables[0] ) {621 622 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );623 624 } else {625 626 do_action( 'groups_screen_group_leave', $bp->groups->current_group->id );627 628 // Show leave group page629 bp_core_load_template( apply_filters( 'groups_template_group_leave', 'groups/single/home' ) );630 592 } 631 593 } … … 1660 1622 $user_id = $bp->loggedin_user->id; 1661 1623 1624 /* Don't let single admins leave the group. */ 1625 if ( count( groups_get_group_admins( $group_id ) ) < 2 ) { 1626 if ( groups_is_user_admin( $user_id, $group_id ) ) 1627 return false; 1628 } 1629 1662 1630 // This is exactly the same as deleting and invite, just is_confirmed = 1 NOT 0. 1663 1631 if ( !groups_uninvite_user( $user_id, $group_id, true ) ) -
trunk/bp-themes/bp-default/_inc/global.js
r2533 r2538 722 722 function(response) 723 723 { 724 response = response.substr(0, response.length-1);725 726 724 var action = thelink.attr('rel'); 727 725 var parentdiv = thelink.parent(); … … 773 771 function(response) 774 772 { 775 response = response.substr(0, response.length-1);776 773 var parentdiv = thelink.parent(); 777 774
Note: See TracChangeset
for help on using the changeset viewer.