From de396f44ce8db90c0487a80e4919403462a28ae0 Mon Sep 17 00:00:00 2001
From: Paul Biron <paul@sparrowhawkcomputing.com>
Date: Tue, 10 Jul 2018 16:22:20 -0600
Subject: [PATCH] refresh patch
---
src/wp-admin/includes/user.php | 58 ++++++++++++++++++++++++++++++++++--------
1 file changed, 47 insertions(+), 11 deletions(-)
diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php
index fa868d9..2cbe2e4 100644
|
a
|
b
|
function _wp_personal_data_export_page() { |
| 799 | 799 | $requests_table = new WP_Privacy_Data_Export_Requests_Table( array( |
| 800 | 800 | 'plural' => 'privacy_requests', |
| 801 | 801 | 'singular' => 'privacy_request', |
| | 802 | 'screen' => 'export_personal_data', |
| 802 | 803 | ) ); |
| 803 | 804 | $requests_table->process_bulk_action(); |
| 804 | 805 | $requests_table->prepare_items(); |
| … |
… |
function _wp_personal_data_removal_page() { |
| 870 | 871 | $requests_table = new WP_Privacy_Data_Removal_Requests_Table( array( |
| 871 | 872 | 'plural' => 'privacy_requests', |
| 872 | 873 | 'singular' => 'privacy_request', |
| | 874 | 'screen' => 'remove_personal_data', |
| 873 | 875 | ) ); |
| 874 | 876 | |
| 875 | 877 | $requests_table->process_bulk_action(); |
| … |
… |
abstract class WP_Privacy_Requests_Table extends WP_List_Table { |
| 1064 | 1066 | * @return array Default sortable columns. |
| 1065 | 1067 | */ |
| 1066 | 1068 | protected function get_sortable_columns() { |
| 1067 | | return array(); |
| | 1069 | return array( |
| | 1070 | 'email' => 'requester', |
| | 1071 | 'created_timestamp' => 'requested', |
| | 1072 | ); |
| 1068 | 1073 | } |
| 1069 | 1074 | |
| 1070 | 1075 | /** |
| … |
… |
abstract class WP_Privacy_Requests_Table extends WP_List_Table { |
| 1212 | 1217 | public function prepare_items() { |
| 1213 | 1218 | global $wpdb; |
| 1214 | 1219 | |
| 1215 | | $primary = $this->get_primary_column_name(); |
| 1216 | | $this->_column_headers = array( |
| 1217 | | $this->get_columns(), |
| 1218 | | array(), |
| 1219 | | $this->get_sortable_columns(), |
| 1220 | | $primary, |
| 1221 | | ); |
| 1222 | | |
| 1223 | 1220 | $this->items = array(); |
| 1224 | 1221 | $posts_per_page = 20; |
| 1225 | 1222 | $args = array( |
| 1226 | 1223 | 'post_type' => $this->post_type, |
| 1227 | 1224 | 'post_name__in' => array( $this->request_type ), |
| 1228 | 1225 | 'posts_per_page' => $posts_per_page, |
| 1229 | | 'offset' => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page : 0, |
| 1230 | 1226 | 'post_status' => 'any', |
| 1231 | | 's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '', |
| 1232 | 1227 | ); |
| 1233 | 1228 | |
| | 1229 | if ( isset( $_REQUEST['paged'] ) && (int) $_REQUEST['paged'] > 0 ) { |
| | 1230 | $args['paged'] = (int) $_REQUEST['paged']; |
| | 1231 | } |
| | 1232 | |
| | 1233 | $is_search = false; |
| | 1234 | if ( isset( $_REQUEST['s'] ) && '' !== $_REQUEST['s'] ) { |
| | 1235 | $args['s'] = sanitize_text_field( $_REQUEST['s'] ); |
| | 1236 | $is_search = true; |
| | 1237 | } |
| | 1238 | |
| | 1239 | $orderby_mapping = array( |
| | 1240 | 'requester' => 'title', |
| | 1241 | 'requested' => 'post_date_gmt', |
| | 1242 | ); |
| | 1243 | |
| | 1244 | $orderby = ''; |
| | 1245 | if ( isset( $_REQUEST['orderby'] ) && isset( $orderby_mapping[ $_REQUEST['orderby'] ] ) ) { |
| | 1246 | $orderby = $orderby_mapping[ $_REQUEST['orderby'] ]; |
| | 1247 | } elseif ( ! $is_search ) { // Don't override default search order by fields. |
| | 1248 | $orderby = 'post_date_gmt'; |
| | 1249 | } |
| | 1250 | |
| | 1251 | if ( $orderby ) { |
| | 1252 | $args['orderby'] = $orderby; |
| | 1253 | } |
| | 1254 | |
| | 1255 | $order = ''; |
| | 1256 | if ( isset( $_REQUEST['order'] ) && in_array( strtoupper( $_REQUEST['order'] ), array( 'ASC', 'DESC' ), true ) ) { |
| | 1257 | $order = strtoupper( $_REQUEST['order'] ); |
| | 1258 | } elseif ( ! $is_search ) { // Don't override the default search order. |
| | 1259 | if ( 'post_date_gmt' === $orderby ) { // Descending default date order. |
| | 1260 | $order = 'DESC'; |
| | 1261 | } else { |
| | 1262 | $order = 'ASC'; |
| | 1263 | } |
| | 1264 | } |
| | 1265 | |
| | 1266 | if ( $order ) { |
| | 1267 | $args['order'] = $order; |
| | 1268 | } |
| | 1269 | |
| 1234 | 1270 | if ( ! empty( $_REQUEST['filter-status'] ) ) { |
| 1235 | 1271 | $filter_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : ''; |
| 1236 | 1272 | $args['post_status'] = $filter_status; |