Make WordPress Core

Ticket #43960: 43960.diff

File 43960.diff, 3.3 KB (added by birgire, 7 years ago)
  • src/wp-admin/includes/user.php

    diff --git src/wp-admin/includes/user.php src/wp-admin/includes/user.php
    index afbc2c8..5e4c575 100644
    function _wp_personal_data_export_page() { 
    798798        $requests_table = new WP_Privacy_Data_Export_Requests_Table( array(
    799799                'plural'   => 'privacy_requests',
    800800                'singular' => 'privacy_request',
     801                'screen'   => 'export_personal_data',
    801802        ) );
    802803        $requests_table->process_bulk_action();
    803804        $requests_table->prepare_items();
    function _wp_personal_data_removal_page() { 
    869870        $requests_table = new WP_Privacy_Data_Removal_Requests_Table( array(
    870871                'plural'   => 'privacy_requests',
    871872                'singular' => 'privacy_request',
     873                'screen'   => 'remove_personal_data',
    872874        ) );
    873875
    874876        $requests_table->process_bulk_action();
    abstract class WP_Privacy_Requests_Table extends WP_List_Table { 
    983985         * @return array
    984986         */
    985987        protected function get_sortable_columns() {
    986                 return array();
     988                return array(
     989                        'email'             => 'requester',
     990                        'created_timestamp' => 'requested',
     991                );
    987992        }
    988993
    989994        /**
    abstract class WP_Privacy_Requests_Table extends WP_List_Table { 
    11301135        public function prepare_items() {
    11311136                global $wpdb;
    11321137
    1133                 $primary               = $this->get_primary_column_name();
    1134                 $this->_column_headers = array(
    1135                         $this->get_columns(),
    1136                         array(),
    1137                         $this->get_sortable_columns(),
    1138                         $primary,
    1139                 );
    1140 
    11411138                $this->items    = array();
    11421139                $posts_per_page = 20;
    11431140                $args           = array(
    11441141                        'post_type'      => $this->post_type,
    11451142                        'post_name__in'  => array( $this->request_type ),
    11461143                        'posts_per_page' => $posts_per_page,
    1147                         'offset'         => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page: 0,
    11481144                        'post_status'    => 'any',
    1149                         's'              => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '',
    11501145                );
    11511146
     1147                if ( isset( $_REQUEST['paged'] ) && (int) $_REQUEST['paged'] > 0 ) {
     1148                        $args['paged'] = (int) $_REQUEST['paged'];
     1149                }
     1150
     1151                $is_search = false;
     1152                if ( isset( $_REQUEST['s'] ) && '' !== $_REQUEST['s'] ) {
     1153                        $args['s'] = sanitize_text_field( $_REQUEST['s'] );
     1154                        $is_search = true;
     1155                }
     1156
     1157                $orderby_mapping = array(
     1158                        'requester' => 'title',
     1159                        'requested' => 'post_date_gmt',
     1160                );
     1161
     1162                $orderby = '';
     1163
     1164                if ( isset( $_REQUEST['orderby'] ) && isset( $orderby_mapping[ $_REQUEST['orderby'] ] ) ) {
     1165                        $orderby = $orderby_mapping[ $_REQUEST['orderby'] ];
     1166                } elseif ( ! $is_search ) { // Don't override default search order by fields.
     1167                        $orderby = 'post_date_gmt';
     1168                }
     1169
     1170                if ( $orderby ) {
     1171                        $args['orderby'] = $orderby;
     1172                }
     1173
     1174                $order = '';
     1175                if ( isset( $_REQUEST['order'] ) && in_array( strtoupper( $_REQUEST['orderby'] ), array( 'ASC', 'DESC' ), true ) ) {
     1176                        $order = strtoupper( $_REQUEST['orderby'] );
     1177                } elseif ( ! $is_search ) { // Don't override the default search order.
     1178                        if ( 'post_date_gmt' === $orderby ) { // Descending default date order.
     1179                                $order = 'DESC';
     1180                        } else {
     1181                                $order = 'ASC';
     1182                        }
     1183                }
     1184
     1185                if ( $order ) {
     1186                        $args['order'] = $order;
     1187                }
     1188
    11521189                if ( ! empty( $_REQUEST['filter-status'] ) ) {
    11531190                        $filter_status       = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
    11541191                        $args['post_status'] = $filter_status;