| | 4 | if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) { |
| | 5 | |
| | 6 | bb_check_admin_referer( 'user-bulk' ); |
| | 7 | $user_ids = array_map( 'absint', $_POST['user'] ); |
| | 8 | $count = 0; |
| | 9 | $bb_current_id = bb_get_current_user_info( 'id' ); |
| | 10 | |
| | 11 | $action = trim( $_POST['action'] ); |
| | 12 | |
| | 13 | switch ( $action ) { |
| | 14 | case 'delete' : |
| | 15 | foreach ( $user_ids as $user_id ) { |
| | 16 | if ( $bb_current_id != $user_id ) |
| | 17 | $count += (int) (bool) bb_delete_user( $user_id ); |
| | 18 | } |
| | 19 | $query_vars = array( 'message' => 'deleted', 'count' => $count ); |
| | 20 | break; |
| | 21 | default : |
| | 22 | if ( $action ) |
| | 23 | $query_vars = apply_filters( "bulk_user__$action", array(), $user_ids, $action ); |
| | 24 | break; |
| | 25 | } |
| | 26 | |
| | 27 | bb_safe_redirect( add_query_arg( $query_vars ) ); |
| | 28 | exit; |
| | 29 | } |
| | 30 | |
| | 31 | if ( !empty( $_GET['message'] ) ) { |
| | 32 | $message_count = isset( $_GET['count'] ) ? (int) $_GET['count'] : 1; |
| | 33 | |
| | 34 | switch ( (string) $_GET['message'] ) { |
| | 35 | case 'deleted': |
| | 36 | bb_admin_notice( sprintf( _n( '<strong>User deleted.</strong>', '<strong>%s users deleted.</strong>', $message_count ), bb_number_format_i18n( $message_count ) ) ); |
| | 37 | break; |
| | 38 | } |
| | 39 | } |
| | 40 | |