diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php
index 82d792fb3c..fb5352305a 100644
|
a
|
b
|
function _wp_privacy_completed_request( $request_id ) { |
| 630 | 630 | |
| 631 | 631 | update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); |
| 632 | 632 | |
| | 633 | $status = 'request-skipped'; |
| | 634 | |
| | 635 | if ( get_post_status( $request_id ) === $status ) { |
| | 636 | return; |
| | 637 | } |
| | 638 | |
| 633 | 639 | $result = wp_update_post( |
| 634 | 640 | array( |
| 635 | 641 | 'ID' => $request_id, |
| … |
… |
function _wp_personal_data_handle_actions() { |
| 687 | 693 | $action_type = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) ); |
| 688 | 694 | $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) ); |
| 689 | 695 | $email_address = ''; |
| | 696 | $request_confirmation = sanitize_text_field( $_POST['request_confirmation'] ); |
| 690 | 697 | |
| 691 | 698 | if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) { |
| 692 | 699 | add_settings_error( |
| … |
… |
function _wp_personal_data_handle_actions() { |
| 717 | 724 | break; |
| 718 | 725 | } |
| 719 | 726 | |
| 720 | | $request_id = wp_create_user_request( $email_address, $action_type ); |
| | 727 | $request_id = wp_create_user_request( $email_address, $action_type, $request_confirmation ); |
| 721 | 728 | |
| 722 | 729 | if ( is_wp_error( $request_id ) ) { |
| 723 | 730 | add_settings_error( |
| … |
… |
function _wp_personal_data_handle_actions() { |
| 737 | 744 | break; |
| 738 | 745 | } |
| 739 | 746 | |
| 740 | | wp_send_user_request( $request_id ); |
| | 747 | if ( 'yes' === $request_confirmation ) { |
| | 748 | wp_send_user_request( $request_id ); |
| | 749 | } |
| 741 | 750 | |
| 742 | 751 | add_settings_error( |
| 743 | 752 | 'username_or_email_for_privacy_request', |
| … |
… |
function _wp_personal_data_export_page() { |
| 837 | 846 | <div class="wp-privacy-request-form-field"> |
| 838 | 847 | <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label> |
| 839 | 848 | <input type="text" required class="regular-text" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" /> |
| 840 | | <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?> |
| | 849 | <select name="request_confirmation"> |
| | 850 | <option value="yes"><?php _e( 'With Confirmation' ); ?></option> |
| | 851 | <option value="no"><?php _e( 'Without Confirmation' ); ?></option> |
| | 852 | </select> |
| | 853 | <?php submit_button( __( 'Add Request' ), 'secondary', 'submit', false ); ?> |
| 841 | 854 | </div> |
| 842 | 855 | <?php wp_nonce_field( 'personal-data-request' ); ?> |
| 843 | 856 | <input type="hidden" name="action" value="add_export_personal_data_request" /> |
| … |
… |
function _wp_personal_data_removal_page() { |
| 921 | 934 | <div class="wp-privacy-request-form-field"> |
| 922 | 935 | <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label> |
| 923 | 936 | <input type="text" required class="regular-text" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" /> |
| 924 | | <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?> |
| | 937 | <select name="request_confirmation"> |
| | 938 | <option value="yes"><?php _e( 'With Confirmation' ); ?></option> |
| | 939 | <option value="no"><?php _e( 'Without Confirmation' ); ?></option> |
| | 940 | </select> |
| | 941 | <?php submit_button( __( 'Add Request' ), 'secondary', 'submit', false ); ?> |
| 925 | 942 | </div> |
| 926 | 943 | <?php wp_nonce_field( 'personal-data-request' ); ?> |
| 927 | 944 | <input type="hidden" name="action" value="add_remove_personal_data_request" /> |
| … |
… |
abstract class WP_Privacy_Requests_Table extends WP_List_Table { |
| 1384 | 1401 | case 'request-completed': |
| 1385 | 1402 | $timestamp = $item->completed_timestamp; |
| 1386 | 1403 | break; |
| | 1404 | case 'request-skipped': |
| | 1405 | $timestamp = $item->completed_timestamp; |
| | 1406 | break; |
| 1387 | 1407 | } |
| 1388 | 1408 | |
| 1389 | 1409 | echo '<span class="status-label status-' . esc_attr( $status ) . '">'; |
| … |
… |
class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Requests_Table { |
| 1556 | 1576 | esc_html_e( 'Waiting for confirmation' ); |
| 1557 | 1577 | break; |
| 1558 | 1578 | case 'request-confirmed': |
| | 1579 | case 'request-skipped': |
| 1559 | 1580 | /** This filter is documented in wp-admin/includes/ajax-actions.php */ |
| 1560 | 1581 | $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); |
| 1561 | 1582 | $exporters_count = count( $exporters ); |
| … |
… |
class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Requests_Table { |
| 1678 | 1699 | esc_html_e( 'Waiting for confirmation' ); |
| 1679 | 1700 | break; |
| 1680 | 1701 | case 'request-confirmed': |
| | 1702 | case 'request-skipped': |
| 1681 | 1703 | /** This filter is documented in wp-admin/includes/ajax-actions.php */ |
| 1682 | 1704 | $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); |
| 1683 | 1705 | $erasers_count = count( $erasers ); |
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index eb69ac727b..38591e4071 100644
|
a
|
b
|
function create_initial_post_types() { |
| 429 | 429 | 'exclude_from_search' => false, |
| 430 | 430 | ) |
| 431 | 431 | ); |
| | 432 | |
| | 433 | register_post_status( |
| | 434 | 'request-skipped', |
| | 435 | array( |
| | 436 | 'label' => _x( 'Confirmation Skipped', 'request status' ), |
| | 437 | 'internal' => true, |
| | 438 | '_builtin' => true, /* internal use only. */ |
| | 439 | 'exclude_from_search' => false, |
| | 440 | ) |
| | 441 | ); |
| 432 | 442 | } |
| 433 | 443 | |
| 434 | 444 | /** |
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 752b92dcde..1e49d1e1f3 100644
|
a
|
b
|
function _wp_privacy_account_request_confirmed_message( $request_id ) { |
| 3301 | 3301 | * |
| 3302 | 3302 | * @since 4.9.6 |
| 3303 | 3303 | * |
| 3304 | | * @param string $email_address User email address. This can be the address of a registered or non-registered user. |
| 3305 | | * @param string $action_name Name of the action that is being confirmed. Required. |
| 3306 | | * @param array $request_data Misc data you want to send with the verification request and pass to the actions once the request is confirmed. |
| 3307 | | * @return int|WP_Error Returns the request ID if successful, or a WP_Error object on failure. |
| | 3304 | * @param string $email_address User email address. This can be the address of a registered or non-registered user. |
| | 3305 | * @param string $action_name Name of the action that is being confirmed. Required. |
| | 3306 | * @param string $request_confirmation Option (yes/no) if the admins wants to send a confirmation e-mail to the user. |
| | 3307 | * @param array $request_data Misc data you want to send with the verification request and pass to the actions once the request is confirmed. |
| | 3308 | * @return int|WP_Error Returns the request ID if successful, or a WP_Error object on failure. |
| 3308 | 3309 | */ |
| 3309 | | function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array() ) { |
| 3310 | | $email_address = sanitize_email( $email_address ); |
| 3311 | | $action_name = sanitize_key( $action_name ); |
| | 3310 | function wp_create_user_request( $email_address = '', $action_name = '', $request_confirmation = '', $request_data = array() ) { |
| | 3311 | $email_address = sanitize_email( $email_address ); |
| | 3312 | $action_name = sanitize_key( $action_name ); |
| | 3313 | $request_confirmation = sanitize_text_field( $request_confirmation ); |
| 3312 | 3314 | |
| 3313 | 3315 | if ( ! is_email( $email_address ) ) { |
| 3314 | 3316 | return new WP_Error( 'invalid_email', __( 'Invalid email address.' ) ); |
| … |
… |
function wp_create_user_request( $email_address = '', $action_name = '', $reques |
| 3339 | 3341 | return new WP_Error( 'duplicate_request', __( 'An incomplete request for this email address already exists.' ) ); |
| 3340 | 3342 | } |
| 3341 | 3343 | |
| | 3344 | if ( 'yes' === $request_confirmation ) { |
| | 3345 | $status = 'request-pending'; |
| | 3346 | } else { |
| | 3347 | $status = 'request-skipped'; |
| | 3348 | } |
| | 3349 | |
| 3342 | 3350 | $request_id = wp_insert_post( |
| 3343 | 3351 | array( |
| 3344 | 3352 | 'post_author' => $user_id, |
| 3345 | 3353 | 'post_name' => $action_name, |
| 3346 | 3354 | 'post_title' => $email_address, |
| 3347 | 3355 | 'post_content' => wp_json_encode( $request_data ), |
| 3348 | | 'post_status' => 'request-pending', |
| | 3356 | 'post_status' => $status, |
| 3349 | 3357 | 'post_type' => 'user_request', |
| 3350 | 3358 | 'post_date' => current_time( 'mysql', false ), |
| 3351 | 3359 | 'post_date_gmt' => current_time( 'mysql', true ), |