Ticket #43443: 43443.6.patch
File 43443.6.patch, 23.7 KB (added by , 6 years ago) |
---|
-
wp-admin/includes/user.php
626 626 } 627 627 628 628 update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() ); 629 629 630 $request = wp_update_post( array( 630 'ID' => $request_ data['request_id'],631 'ID' => $request_id, 631 632 'post_status' => 'request-confirmed', 632 633 ) ); 634 633 635 return $request; 634 636 } 635 637 … … 772 774 } 773 775 774 776 /** 777 * Cleans up failed and expired requests before displaying the list table. 778 * 779 * @since 4.9.6 780 * @access private 781 */ 782 function _wp_personal_data_cleanup_requests() { 783 $expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS ); 784 $requests_query = new WP_Query( array( 785 'post_type' => 'user_request', 786 'posts_per_page' => -1, 787 'post_status' => 'request-pending', 788 'fields' => 'ids', 789 'date_query' => array( 790 array( 791 'column' => 'post_modified_gmt', 792 'before' => $expires . ' seconds ago', 793 ), 794 ), 795 ) ); 796 797 $request_ids = $requests_query->posts; 798 799 foreach ( $request_ids as $request_id ) { 800 wp_update_post( array( 801 'ID' => $request_id, 802 'post_status' => 'request-failed', 803 'post_password' => '', 804 ) ); 805 } 806 } 807 808 /** 775 809 * Personal data export. 776 810 * 777 811 * @since 4.9.6 … … 783 817 } 784 818 785 819 _wp_personal_data_handle_actions(); 820 _wp_personal_data_cleanup_requests(); 786 821 787 822 $requests_table = new WP_Privacy_Data_Export_Requests_Table( array( 788 823 'plural' => 'privacy_requests', … … 844 879 } 845 880 846 881 _wp_personal_data_handle_actions(); 882 _wp_personal_data_cleanup_requests(); 847 883 848 884 // "Borrow" xfn.js for now so we don't have to create new files. 849 885 wp_enqueue_script( 'xfn' ); … … 882 918 883 919 <form class="search-form wp-clearfix"> 884 920 <?php $requests_table->search_box( __( 'Search Requests' ), 'requests' ); ?> 885 <input type="hidden" name="page" value=" export_personal_data" />921 <input type="hidden" name="page" value="remove_personal_data" /> 886 922 <input type="hidden" name="filter-status" value="<?php echo isset( $_REQUEST['filter-status'] ) ? esc_attr( sanitize_text_field( $_REQUEST['filter-status'] ) ) : ''; ?>" /> 887 923 <input type="hidden" name="orderby" value="<?php echo isset( $_REQUEST['orderby'] ) ? esc_attr( sanitize_text_field( $_REQUEST['orderby'] ) ) : ''; ?>" /> 888 924 <input type="hidden" name="order" value="<?php echo isset( $_REQUEST['order'] ) ? esc_attr( sanitize_text_field( $_REQUEST['order'] ) ) : ''; ?>" /> … … 948 984 */ 949 985 public function get_columns() { 950 986 $columns = array( 951 'cb' 952 'email' 953 'status' 954 ' requested_timestamp' => __( 'Requested' ),955 'next_steps' 987 'cb' => '<input type="checkbox" />', 988 'email' => __( 'Requester' ), 989 'status' => __( 'Status' ), 990 'created_timestamp' => __( 'Requested' ), 991 'next_steps' => __( 'Next Steps' ), 956 992 ); 957 993 return $columns; 958 994 } … … 1000 1036 SELECT post_status, COUNT( * ) AS num_posts 1001 1037 FROM {$wpdb->posts} 1002 1038 WHERE post_type = %s 1003 AND post_ title = %s1039 AND post_name = %s 1004 1040 GROUP BY post_status"; 1005 1041 1006 1042 $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $this->post_type, $this->request_type ), ARRAY_A ); … … 1088 1124 case 'resend': 1089 1125 foreach ( $request_ids as $request_id ) { 1090 1126 $resend = _wp_privacy_resend_request( $request_id ); 1091 1127 1092 1128 if ( $resend && ! is_wp_error( $resend ) ) { 1093 1129 $count++; 1094 1130 } … … 1124 1160 $posts_per_page = 20; 1125 1161 $args = array( 1126 1162 'post_type' => $this->post_type, 1127 ' title' => $this->request_type,1163 'post_name__in' => array( $this->request_type ), 1128 1164 'posts_per_page' => $posts_per_page, 1129 1165 'offset' => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page: 0, 1130 1166 'post_status' => 'any', 1167 's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '', 1131 1168 ); 1132 1169 1133 1170 if ( ! empty( $_REQUEST['filter-status'] ) ) { … … 1135 1172 $args['post_status'] = $filter_status; 1136 1173 } 1137 1174 1138 if ( ! empty( $_REQUEST['s'] ) ) {1139 $args['meta_query'] = array(1140 $name_query,1141 'relation' => 'AND',1142 array(1143 'key' => '_wp_user_request_user_email',1144 'value' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ): '',1145 'compare' => 'LIKE',1146 ),1147 );1148 }1149 1150 1175 $requests_query = new WP_Query( $args ); 1151 1176 $requests = $requests_query->posts; 1152 1177 … … 1154 1179 $this->items[] = wp_get_user_request_data( $request->ID ); 1155 1180 } 1156 1181 1182 $this->items = array_filter( $this->items ); 1183 1157 1184 $this->set_pagination_args( 1158 1185 array( 1159 1186 'total_items' => $requests_query->found_posts, … … 1167 1194 * 1168 1195 * @since 4.9.6 1169 1196 * 1170 * @param array$item Item being shown.1197 * @param WP_User_Request $item Item being shown. 1171 1198 * @return string 1172 1199 */ 1173 1200 public function column_cb( $item ) { 1174 return sprintf( '<input type="checkbox" name="request_id[]" value="%1$s" /><span class="spinner"></span>', esc_attr( $item ['request_id']) );1201 return sprintf( '<input type="checkbox" name="request_id[]" value="%1$s" /><span class="spinner"></span>', esc_attr( $item->ID ) ); 1175 1202 } 1176 1203 1177 1204 /** … … 1179 1206 * 1180 1207 * @since 4.9.6 1181 1208 * 1182 * @param array$item Item being shown.1209 * @param WP_User_Request $item Item being shown. 1183 1210 * @return string 1184 1211 */ 1185 1212 public function column_status( $item ) { 1186 $status = get_post_status( $item ['request_id']);1213 $status = get_post_status( $item->ID ); 1187 1214 $status_object = get_post_status_object( $status ); 1188 1215 1189 1216 if ( ! $status_object || empty( $status_object->label ) ) { … … 1194 1221 1195 1222 switch ( $status ) { 1196 1223 case 'request-confirmed': 1197 $timestamp = $item ['confirmed_timestamp'];1224 $timestamp = $item->confirmed_timestamp; 1198 1225 break; 1199 1226 case 'request-completed': 1200 $timestamp = $item ['completed_timestamp'];1227 $timestamp = $item->completed_timestamp; 1201 1228 break; 1202 1229 } 1203 1230 … … 1238 1265 * 1239 1266 * @since 4.9.6 1240 1267 * 1241 * @param array$item Item being shown.1242 * @param string $column_name Name of column being shown.1268 * @param WP_User_Request $item Item being shown. 1269 * @param string $column_name Name of column being shown. 1243 1270 * @return string 1244 1271 */ 1245 1272 public function column_default( $item, $column_name ) { 1246 $cell_value = $item [ $column_name ];1273 $cell_value = $item->$column_name; 1247 1274 1248 if ( in_array( $column_name, array( ' requested_timestamp' ), true ) ) {1275 if ( in_array( $column_name, array( 'created_timestamp' ), true ) ) { 1249 1276 return $this->get_timestamp_as_date( $cell_value ); 1250 1277 } 1251 1278 … … 1257 1284 * 1258 1285 * @since 4.9.6 1259 1286 * 1260 * @param array$item Item being shown.1287 * @param WP_User_Request $item Item being shown. 1261 1288 * @return string 1262 1289 */ 1263 1290 public function column_email( $item ) { 1264 return sprintf( '%1$s %2$s', $item ['email'], $this->row_actions( array() ) );1291 return sprintf( '%1$s %2$s', $item->email, $this->row_actions( array() ) ); 1265 1292 } 1266 1293 1267 1294 /** … … 1269 1296 * 1270 1297 * @since 4.9.6 1271 1298 * 1272 * @param array$item Item being shown.1299 * @param WP_User_Request $item Item being shown. 1273 1300 */ 1274 1301 public function column_next_steps( $item ) {} 1275 1302 … … 1278 1305 * 1279 1306 * @since 4.9.6 1280 1307 * 1281 * @param object $item The current item1308 * @param WP_User_Request $item The current item 1282 1309 */ 1283 1310 public function single_row( $item ) { 1284 $status = get_post_status( $item['request_id'] );1311 $status = $item->status; 1285 1312 1286 1313 echo '<tr class="status-' . esc_attr( $status ) . '">'; 1287 1314 $this->single_row_columns( $item ); … … 1325 1352 * 1326 1353 * @since 4.9.6 1327 1354 * 1328 * @param array$item Item being shown.1355 * @param WP_User_Request $item Item being shown. 1329 1356 * @return string 1330 1357 */ 1331 1358 public function column_email( $item ) { 1332 1359 $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); 1333 1360 $exporters_count = count( $exporters ); 1334 $request_id = $item ['request_id'];1361 $request_id = $item->ID; 1335 1362 $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); 1336 1363 1337 1364 $download_data_markup = '<div class="download_personal_data" ' . … … 1348 1375 'download_data' => $download_data_markup, 1349 1376 ); 1350 1377 1351 return sprintf( '%1$s %2$s', $item ['email'], $this->row_actions( $row_actions ) );1378 return sprintf( '%1$s %2$s', $item->email, $this->row_actions( $row_actions ) ); 1352 1379 } 1353 1380 1354 1381 /** … … 1356 1383 * 1357 1384 * @since 4.9.6 1358 1385 * 1359 * @param array$item Item being shown.1386 * @param WP_User_Request $item Item being shown. 1360 1387 */ 1361 1388 public function column_next_steps( $item ) { 1362 $status = get_post_status( $item['request_id'] );1389 $status = $item->status; 1363 1390 1364 1391 switch ( $status ) { 1365 1392 case 'request-pending': … … 1369 1396 // TODO Complete in follow on patch. 1370 1397 break; 1371 1398 case 'request-failed': 1372 submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item ['request_id']. ']', false );1399 submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false ); 1373 1400 break; 1374 1401 case 'request-completed': 1375 1402 echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array( 1376 1403 'action' => 'delete', 1377 'request_id' => array( $item ['request_id'])1404 'request_id' => array( $item->ID ) 1378 1405 ), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>'; 1379 1406 break; 1380 1407 } … … 1410 1437 * 1411 1438 * @since 4.9.6 1412 1439 * 1413 * @param array$item Item being shown.1440 * @param WP_User_Request $item Item being shown. 1414 1441 * @return string 1415 1442 */ 1416 1443 public function column_email( $item ) { 1417 1444 $row_actions = array(); 1418 1445 1419 // Allow the administrator to "force remove" the personal data even if confirmation has not yet been received 1420 $status = get_post_status( $item['request_id'] );1446 // Allow the administrator to "force remove" the personal data even if confirmation has not yet been received. 1447 $status = $item->status; 1421 1448 if ( 'request-confirmed' !== $status ) { 1422 1449 $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); 1423 1450 $erasers_count = count( $erasers ); 1424 $request_id = $item ['request_id'];1451 $request_id = $item->ID; 1425 1452 $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); 1426 1453 1427 1454 $remove_data_markup = '<div class="remove_personal_data force_remove_personal_data" ' . … … 1439 1466 ); 1440 1467 } 1441 1468 1442 return sprintf( '%1$s %2$s', $item ['email'], $this->row_actions( $row_actions ) );1469 return sprintf( '%1$s %2$s', $item->email, $this->row_actions( $row_actions ) ); 1443 1470 } 1444 1471 1445 1472 /** … … 1447 1474 * 1448 1475 * @since 4.9.6 1449 1476 * 1450 * @param array$item Item being shown.1477 * @param WP_User_Request $item Item being shown. 1451 1478 */ 1452 1479 public function column_next_steps( $item ) { 1453 $status = get_post_status( $item['request_id'] );1480 $status = $item->status; 1454 1481 1455 1482 switch ( $status ) { 1456 1483 case 'request-pending': … … 1459 1486 case 'request-confirmed': 1460 1487 $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); 1461 1488 $erasers_count = count( $erasers ); 1462 $request_id = $item ['request_id'];1489 $request_id = $item->ID; 1463 1490 $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); 1464 1491 1465 1492 echo '<div class="remove_personal_data" ' . … … 1477 1504 1478 1505 break; 1479 1506 case 'request-failed': 1480 submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item ['request_id']. ']', false );1507 submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false ); 1481 1508 break; 1482 1509 case 'request-completed': 1483 1510 echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array( 1484 1511 'action' => 'delete', 1485 'request_id' => array( $item ['request_id']),1512 'request_id' => array( $item->ID ), 1486 1513 ), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>'; 1487 1514 break; 1488 1515 } -
wp-content/plugins
-
wp-content
Property changes on: wp-content/plugins ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,6 ## +order-simulator-woocommerce-master +query-monitor +woocommerce +wp-cron-control +woocommerce-product-type-column +wp-mail-smtp
-
wp-includes/post.php
Property changes on: wp-content ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,4 ## +uploads +upgrade +debug.log +db.php
3980 3980 * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix) 3981 3981 */ 3982 3982 function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) { 3983 if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) ) {3983 if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) || 'user_request' === $post_type ) { 3984 3984 return $slug; 3985 3985 } 3986 3986 -
wp-includes/user.php
2840 2840 return; 2841 2841 } 2842 2842 2843 if ( ! in_array( $request_data ['status'], array( 'request-pending', 'request-failed' ), true ) ) {2843 if ( ! in_array( $request_data->status, array( 'request-pending', 'request-failed' ), true ) ) { 2844 2844 return; 2845 2845 } 2846 2846 2847 2847 update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() ); 2848 2848 wp_update_post( array( 2849 'ID' => $request_ data['request_id'],2849 'ID' => $request_id, 2850 2850 'post_status' => 'request-confirmed', 2851 2851 ) ); 2852 2852 } … … 2862 2862 function _wp_privacy_account_request_confirmed_message( $message, $request_id ) { 2863 2863 $request = wp_get_user_request_data( $request_id ); 2864 2864 2865 if ( $request && in_array( $request ['action'], _wp_privacy_action_request_types(), true ) ) {2865 if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) { 2866 2866 $message = '<p class="message">' . __( 'Action has been confirmed.' ) . '</p>'; 2867 2867 $message .= __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ); 2868 2868 } … … 2900 2900 2901 2901 // Check for duplicates. 2902 2902 $requests_query = new WP_Query( array( 2903 'post_type' => 'user_request', 2904 'title' => $action_name, 2905 'post_status' => 'any', 2906 'fields' => 'ids', 2907 'meta_query' => array( 2908 array( 2909 'key' => '_wp_user_request_user_email', 2910 'value' => $email_address, 2911 ), 2912 ), 2903 'post_type' => 'user_request', 2904 'post_name__in' => array( $action_name ), // Action name stored in post_name column. 2905 'title' => $email_address, // Email address stored in post_title column. 2906 'post_status' => 'any', 2907 'fields' => 'ids', 2913 2908 ) ); 2914 2909 2915 2910 if ( $requests_query->found_posts ) { … … 2918 2913 2919 2914 $request_id = wp_insert_post( array( 2920 2915 'post_author' => $user_id, 2921 'post_title' => $action_name, 2916 'post_name' => $action_name, 2917 'post_title' => $email_address, 2922 2918 'post_content' => wp_json_encode( $request_data ), 2923 2919 'post_status' => 'request-pending', 2924 2920 'post_type' => 'user_request', … … 2926 2922 'post_date_gmt' => current_time( 'mysql', true ), 2927 2923 ), true ); 2928 2924 2929 if ( is_wp_error( $request_id ) ) {2930 return $request_id;2931 }2932 2933 update_post_meta( $request_id, '_wp_user_request_user_email', $email_address );2934 update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', false );2935 2936 2925 return $request_id; 2937 2926 } 2938 2927 … … 2963 2952 * 2964 2953 * @param string $description The default description. 2965 2954 * @param string $action_name The name of the request. 2966 */ 2955 */ 2967 2956 return apply_filters( 'user_request_action_description', $description, $action_name ); 2968 2957 } 2969 2958 … … 2979 2968 */ 2980 2969 function wp_send_user_request( $request_id ) { 2981 2970 $request_id = absint( $request_id ); 2982 $request = get_post( $request_id );2971 $request = wp_get_user_request_data( $request_id ); 2983 2972 2984 if ( ! $request || 'user_request' !== $request->post_type) {2973 if ( ! $request ) { 2985 2974 return new WP_Error( 'user_request_error', __( 'Invalid request.' ) ); 2986 2975 } 2987 2976 2988 if ( 'request-pending' !== $request->post_status ) {2989 wp_update_post( array(2990 'ID' => $request_id,2991 'post_status' => 'request-pending',2992 'post_date' => current_time( 'mysql', false ),2993 'post_date_gmt' => current_time( 'mysql', true ),2994 ) );2995 }2996 2997 2977 $email_data = array( 2998 'action_name' => $request->post_title, 2999 'email' => get_post_meta( $request->ID, '_wp_user_request_user_email', true ), 3000 'description' => wp_user_request_action_description( $request->post_title ), 2978 'email' => $request->email, 2979 'description' => wp_user_request_action_description( $request->action_name ), 3001 2980 'confirm_url' => add_query_arg( array( 3002 2981 'action' => 'confirmaction', 3003 2982 'request_id' => $request_id, … … 3045 3024 * @param array $email_data { 3046 3025 * Data relating to the account action email. 3047 3026 * 3048 * @type string $action_name Name of the action being performed.3049 * @type string $email The email address this is being sent to.3050 * @type string $description Description of the action being performed so the user knows what the email is for.3051 * @type string $confirm_url The link to click on to confirm the account action.3052 * @type string $sitename The site name sending the mail.3053 * @type string $siteurl The site URL sending the mail.3027 * @type WP_User_Request $request User request object. 3028 * @type string $email The email address this is being sent to. 3029 * @type string $description Description of the action being performed so the user knows what the email is for. 3030 * @type string $confirm_url The link to click on to confirm the account action. 3031 * @type string $sitename The site name sending the mail. 3032 * @type string $siteurl The site URL sending the mail. 3054 3033 * } 3055 3034 */ 3056 3035 $content = apply_filters( 'user_request_action_email_content', $email_text, $email_data ); … … 3066 3045 } 3067 3046 3068 3047 /** 3069 * Returns a confirmation key for a user action and stores the hashed version .3048 * Returns a confirmation key for a user action and stores the hashed version for future comparison. 3070 3049 * 3071 3050 * @since 4.9.6 3072 3051 * … … 3085 3064 $wp_hasher = new PasswordHash( 8, true ); 3086 3065 } 3087 3066 3088 update_post_meta( $request_id, '_wp_user_request_confirm_key', $wp_hasher->HashPassword( $key ) ); 3089 update_post_meta( $request_id, '_wp_user_request_confirm_key_timestamp', time() ); 3067 wp_update_post( array( 3068 'ID' => $request_id, 3069 'post_status' => 'request-pending', 3070 'post_password' => $wp_hasher->HashPassword( $key ), 3071 'post_modified' => current_time( 'mysql', false ), 3072 'post_modified_gmt' => current_time( 'mysql', true ), 3073 ) ); 3090 3074 3091 3075 return $key; 3092 3076 } … … 3110 3094 return new WP_Error( 'user_request_error', __( 'Invalid request.' ) ); 3111 3095 } 3112 3096 3113 if ( ! in_array( $request ['status'], array( 'request-pending', 'request-failed' ), true ) ) {3097 if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) { 3114 3098 return __( 'This link has expired.' ); 3115 3099 } 3116 3100 … … 3123 3107 $wp_hasher = new PasswordHash( 8, true ); 3124 3108 } 3125 3109 3126 $key_request_time = $request ['confirm_key_timestamp'];3127 $saved_key = $request ['confirm_key'];3110 $key_request_time = $request->modified_timestamp; 3111 $saved_key = $request->confirm_key; 3128 3112 3129 3113 if ( ! $saved_key ) { 3130 3114 return new WP_Error( 'invalid_key', __( 'Invalid key' ) ); … … 3165 3149 */ 3166 3150 function wp_get_user_request_data( $request_id ) { 3167 3151 $request_id = absint( $request_id ); 3168 $ request= get_post( $request_id );3152 $post = get_post( $request_id ); 3169 3153 3170 if ( ! $ request || 'user_request' !== $request->post_type ) {3154 if ( ! $post || 'user_request' !== $post->post_type ) { 3171 3155 return false; 3172 3156 } 3173 3157 3174 return array( 3175 'request_id' => $request->ID, 3176 'user_id' => $request->post_author, 3177 'email' => get_post_meta( $request->ID, '_wp_user_request_user_email', true ), 3178 'action' => $request->post_title, 3179 'requested_timestamp' => strtotime( $request->post_date_gmt ), 3180 'confirmed_timestamp' => get_post_meta( $request->ID, '_wp_user_request_confirmed_timestamp', true ), 3181 'completed_timestamp' => get_post_meta( $request->ID, '_wp_user_request_completed_timestamp', true ), 3182 'request_data' => json_decode( $request->post_content, true ), 3183 'status' => $request->post_status, 3184 'confirm_key' => get_post_meta( $request_id, '_wp_user_request_confirm_key', true ), 3185 'confirm_key_timestamp' => get_post_meta( $request_id, '_wp_user_request_confirm_key_timestamp', true ), 3186 ); 3158 return new WP_User_Request( $post ); 3187 3159 } 3160 3161 /** 3162 * WP_User_Request class. 3163 * 3164 * Represents user request data loaded from a WP_Post object. 3165 * 3166 * @since 4.9.6 3167 */ 3168 class WP_User_Request { 3169 /** 3170 * Request ID. 3171 * 3172 * @var int 3173 */ 3174 public $ID = 0; 3175 3176 /** 3177 * User ID. 3178 * 3179 * @var int 3180 */ 3181 3182 public $user_id = 0; 3183 3184 /** 3185 * User email. 3186 * 3187 * @var int 3188 */ 3189 public $email = ''; 3190 3191 /** 3192 * Action name. 3193 * 3194 * @var string 3195 */ 3196 public $action_name = ''; 3197 3198 /** 3199 * Current status. 3200 * 3201 * @var string 3202 */ 3203 public $status = ''; 3204 3205 /** 3206 * Timestamp this request was created. 3207 * 3208 * @var int|null 3209 */ 3210 public $created_timestamp = null; 3211 3212 /** 3213 * Timestamp this request was last modified. 3214 * 3215 * @var int|null 3216 */ 3217 public $modified_timestamp = null; 3218 3219 /** 3220 * Timestamp this request was confirmed. 3221 * 3222 * @var int 3223 */ 3224 public $confirmed_timestamp = null; 3225 3226 /** 3227 * Timestamp this request was completed. 3228 * 3229 * @var int 3230 */ 3231 public $completed_timestamp = null; 3232 3233 /** 3234 * Misc data assigned to this request. 3235 * 3236 * @var array 3237 */ 3238 public $request_data = array(); 3239 3240 /** 3241 * Key used to confirm this request. 3242 * 3243 * @var string 3244 */ 3245 public $confirm_key = ''; 3246 3247 /** 3248 * Constructor. 3249 * 3250 * @since 3.5.0 3251 * 3252 * @param WP_Post|object $post Post object. 3253 */ 3254 public function __construct( $post ) { 3255 $this->ID = $post->ID; 3256 $this->user_id = $post->post_author; 3257 $this->email = $post->post_title; 3258 $this->action_name = $post->post_name; 3259 $this->status = $post->post_status; 3260 $this->created_timestamp = strtotime( $post->post_date_gmt ); 3261 $this->modified_timestamp = strtotime( $post->post_modified_gmt ); 3262 $this->confirmed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_confirmed_timestamp', true ); 3263 $this->completed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_completed_timestamp', true ); 3264 $this->request_data = json_decode( $post->post_content, true ); 3265 $this->confirm_key = $post->post_password; 3266 } 3267 } 3268 No newline at end of file -
.