Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/04/2013 01:23:22 PM (12 years ago)
Author:
boonebgorges
Message:

Fix bug preventing groups from being deleted in bulk

Also fixes redirect after group deletion

Fixes #4861

Hat tip to imath for original patch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-admin.php

    r6834 r6835  
    8686        check_admin_referer( 'bp-groups-delete' );
    8787
    88         $group_id = (int) $_GET['gid'];
    89 
    90         $result = groups_delete_group( $group_id );
    91 
    92         if ( $result ) {
    93             $redirect_to = add_query_arg( 'deleted', '1', $redirect_to );
    94         } else {
    95             $redirect_to = add_query_arg( array(
    96                 'deleted' => 0,
    97                 'action'  => 'edit',
    98                 'gid'     => $group_id
    99             ) );
    100         }
     88        $group_ids = wp_parse_id_list( $_GET['gid'] );
     89
     90        $count = 0;
     91        foreach ( $group_ids as $group_id ) {
     92            if ( groups_delete_group( $group_id ) ) {
     93                $count++;
     94            }
     95        }
     96
     97        $redirect_to = add_query_arg( 'deleted', $count, $redirect_to );
    10198
    10299        bp_core_redirect( $redirect_to );
Note: See TracChangeset for help on using the changeset viewer.