Skip to:
Content

BuddyPress.org

Changeset 2582


Ignore:
Timestamp:
02/04/2010 11:51:04 AM (14 years ago)
Author:
apeatling
Message:

Fixes #1801

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups.php

    r2576 r2582  
    16241624    /* Don't let single admins leave the group. */
    16251625    if ( count( groups_get_group_admins( $group_id ) ) < 2 ) {
    1626         if ( groups_is_user_admin( $user_id, $group_id ) )
     1626        if ( groups_is_user_admin( $user_id, $group_id ) ) {
     1627            bp_core_add_message( __( 'As the only Admin, you cannot leave the group.', 'buddypress' ), 'error' );
    16271628            return false;
    1628     }
    1629 
    1630     // This is exactly the same as deleting and invite, just is_confirmed = 1 NOT 0.
    1631     if ( !groups_uninvite_user( $user_id, $group_id, true ) )
     1629        }
     1630    }
     1631
     1632    // This is exactly the same as deleting an invite, just is_confirmed = 1 NOT 0.
     1633    if ( !groups_uninvite_user( $user_id, $group_id ) )
    16321634        return false;
    16331635
     
    16361638    /* Modify group member count */
    16371639    groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') - 1 );
     1640
     1641    /* Modify user's group memberhip count */
     1642    update_usermeta( $user_id, 'total_group_count', (int) get_usermeta( $user_id, 'total_group_count') - 1 );
     1643
     1644    bp_core_add_message( __( 'You successfully left the group.', 'buddypress' ) );
    16381645
    16391646    return true;
  • trunk/bp-groups/bp-groups-classes.php

    r2581 r2582  
    759759    /* Static Functions */
    760760
    761     function delete( $user_id, $group_id, $check_empty = true ) {
    762         global $wpdb, $bp;
    763 
    764         $delete_result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
    765 
    766         return $delete_result;
     761    function delete( $user_id, $group_id ) {
     762        global $wpdb, $bp;
     763
     764        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
    767765    }
    768766
Note: See TracChangeset for help on using the changeset viewer.