Ticket #6530: 6530.diff

File 6530.diff, 2.6 KB (added by greuben, 2 years ago)

I tried to do it less complicated way but I don't think its the best solution. Anyways...

Line 
1Index: wp-admin/edit-comments.php
2===================================================================
3--- wp-admin/edit-comments.php  (revision 17159)
4+++ wp-admin/edit-comments.php  (working copy)
5@@ -14,6 +14,8 @@
6 $wp_list_table = get_list_table('WP_Comments_List_Table');
7 $pagenum = $wp_list_table->get_pagenum();
8 
9+$parent_file = 'edit-comments.php';
10+
11 $doaction = $wp_list_table->current_action();
12 
13 if ( $doaction ) {
14Index: wp-admin/includes/class-wp-list-table.php
15===================================================================
16--- wp-admin/includes/class-wp-list-table.php   (revision 17159)
17+++ wp-admin/includes/class-wp-list-table.php   (working copy)
18@@ -476,7 +476,12 @@
19 
20                $current = $this->get_pagenum();
21 
22-               $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
23+               if( defined('DOING_AJAX') && DOING_AJAX ) {
24+                       $current_url = admin_url( $_GET['list_args']['screen']['parent_file'] );
25+                       $current--;
26+               } else {
27+                       $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
28+               }
29 
30                $page_links = array();
31 
32@@ -851,11 +856,21 @@
33                        $this->display_rows();
34                else
35                        $this->display_rows_or_placeholder();
36+               
37+               $rows = ob_get_contents();
38+               ob_clean();
39+               
40+               $this->display_tablenav( 'top' );
41+               $top_pagination = ob_get_contents();
42+               ob_clean();
43+               
44+               $this->display_tablenav( 'bottom' );
45+               $bottom_pagination = ob_get_contents();
46+               
47+               ob_end_clean();
48 
49-               $rows = ob_get_clean();
50+               $response = array( 'rows' => $rows, 'top_pagination' => $top_pagination, 'bottom_pagination' => $bottom_pagination );
51 
52-               $response = array( 'rows' => $rows );
53-
54                if ( isset( $total_items ) )
55                        $response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
56 
57Index: wp-admin/js/edit-comments.dev.js
58===================================================================
59--- wp-admin/js/edit-comments.dev.js    (revision 17159)
60+++ wp-admin/js/edit-comments.dev.js    (working copy)
61@@ -235,8 +235,14 @@
62 
63                listTable.fetch_list(args, function(response) {
64                        theExtraList.get(0).wpList.add( response.rows );
65+                       updatePagination( response.top_pagination, response.bottom_pagination );
66                });
67        };
68+       
69+       var updatePagination = function( top, bottom ){
70+               $('.tablenav.top').before( top ).remove();
71+               $('.tablenav.bottom').before( bottom ).remove();
72+       }
73 
74        theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
75        theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )