Changeset 6280
- Timestamp:
- 08/31/2012 02:29:29 AM (12 years ago)
- Location:
- trunk/bp-groups
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/admin/css/admin.css
r6267 r6280 15 15 margin-bottom: 15px; 16 16 } 17 ul.bp-group-delete-list { 18 list-style-type: disc; 19 margin: 4px 26px; 20 } -
trunk/bp-groups/bp-groups-admin.php
r6267 r6280 62 62 63 63 // Edit screen 64 if ( 'd elete' == $doaction && ! empty( $_GET['gid'] ) ) {64 if ( 'do_delete' == $doaction && ! empty( $_GET['gid'] ) ) { 65 65 66 66 check_admin_referer( 'bp-groups-delete' ); … … 372 372 $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : ''; 373 373 374 // Display the single activityedit screen374 // Display the single group edit screen 375 375 if ( 'edit' == $doaction && ! empty( $_GET['gid'] ) ) { 376 376 bp_groups_admin_edit(); 377 377 378 // Otherwise, display the Activity index screen 378 // Display the group deletion confirmation screen 379 } else if ( 'delete' == $doaction && ! empty( $_GET['gid'] ) ) { 380 bp_groups_admin_delete(); 381 382 // Otherwise, display the groups index screen 379 383 } else { 380 384 bp_groups_admin_index(); … … 391 395 global $screen_layout_columns; 392 396 393 // @todo: Check if user is allowed to edit activity items394 // if ( ! current_user_can( 'bp_edit_activity' ) )395 397 if ( ! is_super_admin() ) 396 398 die( '-1' ); … … 502 504 503 505 <?php 506 } 507 508 /** 509 * Display the Group delete confirmation screen 510 * 511 * We include a separate confirmation because group deletion is truly 512 * irreversible. 513 * 514 * @since (BuddyPress) 1.7 515 */ 516 function bp_groups_admin_delete() { 517 518 if ( ! is_super_admin() ) 519 die( '-1' ); 520 521 $group_ids = isset( $_REQUEST['gid'] ) ? $_REQUEST['gid'] : 0; 522 if ( ! is_array( $group_ids ) ) { 523 $group_ids = explode( ',', $group_ids ); 524 } 525 $group_ids = wp_parse_id_list( $group_ids ); 526 $groups = groups_get_groups( array( 'include' => $group_ids ) ); 527 528 // Create a new list of group ids, based on those that actually exist 529 $gids = array(); 530 foreach ( $groups['groups'] as $group ) { 531 $gids[] = $group->id; 532 } 533 534 $base_url = remove_query_arg( array( 'action', 'action2', 'paged', 's', '_wpnonce', 'gid' ), $_SERVER['REQUEST_URI'] ); 535 536 ?> 537 538 <div class="wrap"> 539 <?php screen_icon( 'buddypress-groups' ); ?> 540 <h2><?php _e( 'Delete Groups', 'buddypress' ) ?></h2> 541 <p><?php _e( 'You are about to delete the following groups:', 'buddypress' ) ?></p> 542 543 <ul class="bp-group-delete-list"> 544 <?php foreach ( $groups['groups'] as $group ) : ?> 545 <li><?php echo esc_html( $group->name ) ?></li> 546 <?php endforeach; ?> 547 </ul> 548 549 <p><strong><?php _e( 'This action cannot be undone.', 'buddypress' ) ?></strong></p> 550 551 <a class="button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'do_delete', 'gid' => implode( ',', $gids ) ), $base_url ), 'bp-groups-delete' ) ?>"><?php _e( 'Delete Permanently', 'buddypress' ) ?></a> 552 <a class="button" href="<?php echo $base_url ?>"><?php _e( 'Cancel', 'buddypress' ) ?></a> 553 </div> 554 555 <?php 504 556 } 505 557 … … 754 806 <div id="major-publishing-actions"> 755 807 <div id="delete-action"> 756 <a onclick="javascript:return confirm('<?php echo esc_js( __( 'Are you sure?', 'buddypress' ) ) ?>');" class="submitdelete deletion" href="<?php echo wp_nonce_url( add_query_arg( 'action', 'delete', $base_url ), 'bp-groups-delete' ) ?>"><?php _e( 'Delete', 'buddypress' ) ?></a>808 <a class="submitdelete deletion" href="<?php echo wp_nonce_url( add_query_arg( 'action', 'delete', $base_url ), 'bp-groups-delete' ) ?>"><?php _e( 'Delete Group', 'buddypress' ) ?></a> 757 809 </div> 758 810 … … 1057 1109 function get_bulk_actions() { 1058 1110 $actions = array(); 1059 $actions[' bulk_delete'] = __( 'Delete Permanently', 'buddypress' );1111 $actions['delete'] = __( 'Delete', 'buddypress' ); 1060 1112 1061 1113 return apply_filters( 'bp_groups_list_table_get_bulk_actions', $actions ); … … 1104 1156 */ 1105 1157 function column_cb( $item ) { 1106 printf( '<input type="checkbox" name=" aid[]" value="%d" />', (int) $item['id'] );1158 printf( '<input type="checkbox" name="gid[]" value="%d" />', (int) $item['id'] ); 1107 1159 } 1108 1160 … … 1129 1181 function column_comment( $item ) { 1130 1182 1131 // Preorder items: Visit | Edit | Delete Permanently1183 // Preorder items: Visit | Edit | Delete 1132 1184 $actions = array( 1133 1185 'visit' => '', … … 1141 1193 // Build actions URLs 1142 1194 $base_url = network_admin_url( 'admin.php?page=bp-groups&gid=' . $item['id'] ); 1143 $spam_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'spam-groups_' . $item['id'] ) ); 1144 1145 $delete_url = $base_url . "&action=delete&$spam_nonce"; 1195 1196 $delete_url = wp_nonce_url( $base_url . "&action=delete", 'bp-groups-delete' ); 1146 1197 $edit_url = $base_url . '&action=edit'; 1147 1198 $visit_url = bp_get_group_permalink( $item_obj ); … … 1156 1207 1157 1208 // Delete 1158 $actions['delete'] = sprintf( '<a href="%s" onclick="%s">%s</a>', $delete_url, "javascript:return confirm('" . esc_js( __( 'Are you sure?', 'buddypress' ) ) . "'); ", __( 'Delete Permanently', 'buddypress' ) );1209 $actions['delete'] = sprintf( '<a href="%s">%s</a>', $delete_url, __( 'Delete', 'buddypress' ) ); 1159 1210 1160 1211 // Other plugins can filter which actions are shown
Note: See TracChangeset
for help on using the changeset viewer.