Skip to:
Content

BuddyPress.org

Changeset 2538


Ignore:
Timestamp:
02/02/2010 05:32:15 PM (15 years ago)
Author:
apeatling
Message:

Fixes #1753

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups.php

    r2537 r2538  
    211211                if ( function_exists('friends_install') )
    212212                    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 ) );
    215213            }
    216214        }
     
    592590            // Show send invite page
    593591            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 page
    629             bp_core_load_template( apply_filters( 'groups_template_group_leave', 'groups/single/home' ) );
    630592        }
    631593    }
     
    16601622        $user_id = $bp->loggedin_user->id;
    16611623
     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
    16621630    // This is exactly the same as deleting and invite, just is_confirmed = 1 NOT 0.
    16631631    if ( !groups_uninvite_user( $user_id, $group_id, true ) )
  • trunk/bp-themes/bp-default/_inc/global.js

    r2533 r2538  
    722722        function(response)
    723723        {
    724             response = response.substr(0, response.length-1);
    725 
    726724            var action = thelink.attr('rel');
    727725            var parentdiv = thelink.parent();
     
    773771        function(response)
    774772        {
    775             response = response.substr(0, response.length-1);
    776773            var parentdiv = thelink.parent();
    777774
Note: See TracChangeset for help on using the changeset viewer.