Changeset 16855
- Timestamp:
- 12/10/2010 08:49:16 AM (12 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r16619 r16855 14 14 $wp_list_table = get_list_table('WP_Comments_List_Table'); 15 15 $wp_list_table->check_permissions(); 16 $pagenum = $wp_list_table->get_pagenum(); 16 17 17 18 $doaction = $wp_list_table->current_action(); … … 37 38 $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; 38 39 $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); 40 41 // Fix the problem with wrong page number. This happens when the user use the javascript 42 // pagination feature to navigate to a certain page, then does some bulk actions there, 43 // he will be redirected back to te original page number instead of the navigated one. 44 $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); 39 45 40 46 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each … … 100 106 $wp_list_table->prepare_items(); 101 107 108 // redirect to the last page if the page number is larger than the total number of pages 109 // this can happen when all the items in the last page are deleted, for example 110 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 111 if ( $pagenum > $total_pages && $total_pages > 0 ) { 112 wp_redirect( add_query_arg( 'paged', $total_pages ) ); 113 exit; 114 } 115 102 116 wp_enqueue_script('admin-comments'); 103 117 enqueue_comment_hotkeys_js(); -
trunk/wp-admin/edit.php
r16779 r16855 11 11 $wp_list_table = get_list_table('WP_Posts_List_Table'); 12 12 $wp_list_table->check_permissions(); 13 $pagenum = $wp_list_table->get_pagenum(); 13 14 14 15 // Back-compat for viewing comments of an entry … … 27 28 check_admin_referer('bulk-posts'); 28 29 $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() ); 30 31 // Fix the problem with wrong page number. This happens when the user use the javascript 32 // pagination feature to navigate to a certain page, then does some bulk actions there, 33 // he will be redirected back to te original page number instead of the navigated one. 34 $sendback = add_query_arg( 'paged', $pagenum, $sendback ); 29 35 30 36 if ( strpos($sendback, 'post.php') !== false ) … … 61 67 $trashed++; 62 68 } 63 $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids) ), $sendback );69 $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids) ), $sendback ); 64 70 break; 65 71 case 'untrash': … … 127 133 128 134 $wp_list_table->prepare_items(); 135 136 // redirect to the last page if the page number is larger than the total number of pages 137 // this can happen when all the items in the last page are deleted, for example 138 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 139 if ( $pagenum > $total_pages && $total_pages > 0 ) { 140 wp_redirect( add_query_arg( 'paged', $total_pages ) ); 141 exit; 142 } 129 143 130 144 wp_enqueue_script('inline-edit-post');
Note: See TracChangeset
for help on using the changeset viewer.