Skip to:
Content

BuddyPress.org

Ticket #4861: 4861.diff

File 4861.diff, 2.0 KB (added by imath, 12 years ago)
  • bp-groups/bp-groups-admin.php

     
    9292
    9393                check_admin_referer( 'bp-groups-delete' );
    9494
    95                 $group_id = (int) $_GET['gid'];
     95                $groups = explode( ',', $_GET['gid'] );
     96                $result = false;
     97               
     98                // check for bulk deletion
     99                if( is_array( $groups ) && count( $groups ) > 1 ) {
     100                       
     101                        foreach( $groups as $group_id ) {
     102                                $result += intval( groups_delete_group( $group_id ) );
     103                        }
     104                       
     105                } else {
     106                        $group_id = intval( $groups[0] );
     107                       
     108                        $result = intval( groups_delete_group( $group_id ) );
     109                }
    96110
    97                 $result = groups_delete_group( $group_id );
    98 
    99111                if ( $result ) {
    100                         $redirect_to = add_query_arg( 'deleted', '1', $redirect_to );
     112                        $redirect_to = add_query_arg( 'deleted', $result, $redirect_to );
    101113                } else {
    102114                        $redirect_to = add_query_arg( array(
    103115                                'deleted' => 0,
     
    409421function bp_groups_admin() {
    410422        // Decide whether to load the index or edit screen
    411423        $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
     424       
     425        /*
     426        at line 80 $_REQUEST['action'] = $_REQUEST['action2']; doesn't allow $doaction to be set as delete
     427        in case of bulk actions
     428        this is a quick and dirty fix :(
     429        */
     430        if( $doaction == -1 && $_GET['action'] == 'delete' && ! empty( $_GET['gid'] ) )
     431                $doaction = $_GET['action'];
     432        /* end of dirty fix */
    412433
    413434        // Display the single group edit screen
    414435        if ( 'edit' == $doaction && ! empty( $_GET['gid'] ) ) {
     
    613634                $deleted  = ! empty( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0;
    614635
    615636                if ( $deleted > 0 ) {
    616                         $messages[] = sprintf( _n( '%s activity has been permanently deleted.', '%s activity items have been permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) );
     637                        $messages[] = sprintf( _n( '%s group has been permanently deleted.', '%s groups have been permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) );
    617638                }
    618639        }
    619640