diff --git a/src/wp-admin/css/forms.css b/src/wp-admin/css/forms.css
index f790875a48..59bbd42571 100644
|
a
|
b
|
table.form-table td .updated p { |
| 1210 | 1210 | line-height: 1.5; |
| 1211 | 1211 | margin: 0; |
| 1212 | 1212 | } |
| | 1213 | .wp-privacy-request-form select { |
| | 1214 | margin-top: -4px; |
| | 1215 | } |
| 1213 | 1216 | |
| 1214 | 1217 | .email-personal-data::before { |
| 1215 | 1218 | display: inline-block; |
diff --git a/src/wp-admin/erase-personal-data.php b/src/wp-admin/erase-personal-data.php
index dc80022eef..67fb577668 100644
|
a
|
b
|
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
| 63 | 63 | <div class="wp-privacy-request-form-field"> |
| 64 | 64 | <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label> |
| 65 | 65 | <input type="text" required class="regular-text" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" /> |
| | 66 | <select name="request_confirmation" id="confirmation_for_privacy_request"> |
| | 67 | <option value="yes"><?php _e( 'With Confirmation' ); ?></option> |
| | 68 | <option value="no"><?php _e( 'Without Confirmation' ); ?></option> |
| | 69 | </select> |
| 66 | 70 | <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?> |
| 67 | 71 | </div> |
| 68 | 72 | <?php wp_nonce_field( 'personal-data-request' ); ?> |
diff --git a/src/wp-admin/export-personal-data.php b/src/wp-admin/export-personal-data.php
index a4eef779c2..99ae12f9b0 100644
|
a
|
b
|
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
| 63 | 63 | <div class="wp-privacy-request-form-field"> |
| 64 | 64 | <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label> |
| 65 | 65 | <input type="text" required class="regular-text" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" /> |
| | 66 | <select name="request_confirmation" id="confirmation_for_privacy_request"> |
| | 67 | <option value="yes"><?php _e( 'With Confirmation' ); ?></option> |
| | 68 | <option value="no"><?php _e( 'Without Confirmation' ); ?></option> |
| | 69 | </select> |
| 66 | 70 | <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?> |
| 67 | 71 | </div> |
| 68 | 72 | <?php wp_nonce_field( 'personal-data-request' ); ?> |
diff --git a/src/wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php b/src/wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php
index 683ea69697..1a3045b6a9 100644
|
a
|
b
|
class WP_Privacy_Data_Export_Requests_List_Table extends WP_Privacy_Requests_Tab |
| 111 | 111 | submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false ); |
| 112 | 112 | break; |
| 113 | 113 | case 'request-completed': |
| | 114 | case 'request-skipped': |
| 114 | 115 | echo '<a href="' . esc_url( |
| 115 | 116 | wp_nonce_url( |
| 116 | 117 | add_query_arg( |
diff --git a/src/wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php b/src/wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php
index 53488dd6df..b41285f5b0 100644
|
a
|
b
|
class WP_Privacy_Data_Removal_Requests_List_Table extends WP_Privacy_Requests_Ta |
| 116 | 116 | submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false ); |
| 117 | 117 | break; |
| 118 | 118 | case 'request-completed': |
| | 119 | case 'request-skipped': |
| 119 | 120 | echo '<a href="' . esc_url( |
| 120 | 121 | wp_nonce_url( |
| 121 | 122 | add_query_arg( |
diff --git a/src/wp-admin/includes/class-wp-privacy-requests-table.php b/src/wp-admin/includes/class-wp-privacy-requests-table.php
index fe5a516431..d859c9dcd2 100644
|
a
|
b
|
abstract class WP_Privacy_Requests_Table extends WP_List_Table { |
| 350 | 350 | $timestamp = $item->confirmed_timestamp; |
| 351 | 351 | break; |
| 352 | 352 | case 'request-completed': |
| | 353 | case 'request-skipped': |
| 353 | 354 | $timestamp = $item->completed_timestamp; |
| 354 | 355 | break; |
| 355 | 356 | } |
diff --git a/src/wp-admin/includes/privacy-tools.php b/src/wp-admin/includes/privacy-tools.php
index 7e2badcb4e..f99b295ff9 100644
|
a
|
b
|
function _wp_privacy_completed_request( $request_id ) { |
| 53 | 53 | |
| 54 | 54 | update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); |
| 55 | 55 | |
| | 56 | if ( get_post_status( $request_id ) === 'request-skipped' ) { |
| | 57 | return; |
| | 58 | } |
| | 59 | |
| 56 | 60 | $result = wp_update_post( |
| 57 | 61 | array( |
| 58 | 62 | 'ID' => $request_id, |
| … |
… |
function _wp_personal_data_handle_actions() { |
| 110 | 114 | $action_type = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) ); |
| 111 | 115 | $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) ); |
| 112 | 116 | $email_address = ''; |
| | 117 | $request_confirmation = sanitize_text_field( $_POST['request_confirmation'] ); |
| 113 | 118 | |
| 114 | 119 | if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) { |
| 115 | 120 | add_settings_error( |
| … |
… |
function _wp_personal_data_handle_actions() { |
| 140 | 145 | break; |
| 141 | 146 | } |
| 142 | 147 | |
| 143 | | $request_id = wp_create_user_request( $email_address, $action_type ); |
| | 148 | $request_id = wp_create_user_request( $email_address, $action_type, $request_confirmation ); |
| 144 | 149 | |
| 145 | 150 | if ( is_wp_error( $request_id ) ) { |
| 146 | 151 | add_settings_error( |
| … |
… |
function _wp_personal_data_handle_actions() { |
| 160 | 165 | break; |
| 161 | 166 | } |
| 162 | 167 | |
| 163 | | wp_send_user_request( $request_id ); |
| | 168 | if ( 'yes' === $request_confirmation ) { |
| | 169 | wp_send_user_request( $request_id ); |
| | 170 | } |
| 164 | 171 | |
| 165 | 172 | add_settings_error( |
| 166 | 173 | 'username_or_email_for_privacy_request', |
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 5856af56ca..fbdcd47382 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 c3b911f0dd..e3afaed9c4 100644
|
a
|
b
|
function _wp_privacy_account_request_confirmed_message( $request_id ) { |
| 3316 | 3316 | * |
| 3317 | 3317 | * @since 4.9.6 |
| 3318 | 3318 | * |
| 3319 | | * @param string $email_address User email address. This can be the address of a registered or non-registered user. |
| 3320 | | * @param string $action_name Name of the action that is being confirmed. Required. |
| 3321 | | * @param array $request_data Misc data you want to send with the verification request and pass to the actions once the request is confirmed. |
| 3322 | | * @return int|WP_Error Returns the request ID if successful, or a WP_Error object on failure. |
| | 3319 | * @param string $email_address User email address. This can be the address of a registered or non-registered user. |
| | 3320 | * @param string $action_name Name of the action that is being confirmed. Required. |
| | 3321 | * @param string $request_confirmation Option (yes/no) if a confirmation e-mail will be sent to the user. |
| | 3322 | * @param array $request_data Misc data you want to send with the verification request and pass to the actions once the request is confirmed. |
| | 3323 | * @return int|WP_Error Returns the request ID if successful, or a WP_Error object on failure. |
| 3323 | 3324 | */ |
| 3324 | | function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array() ) { |
| 3325 | | $email_address = sanitize_email( $email_address ); |
| 3326 | | $action_name = sanitize_key( $action_name ); |
| | 3325 | function wp_create_user_request( $email_address = '', $action_name = '', $request_confirmation = '', $request_data = array() ) { |
| | 3326 | $email_address = sanitize_email( $email_address ); |
| | 3327 | $action_name = sanitize_key( $action_name ); |
| | 3328 | $request_confirmation = sanitize_text_field( $request_confirmation ); |
| 3327 | 3329 | |
| 3328 | 3330 | if ( ! is_email( $email_address ) ) { |
| 3329 | 3331 | return new WP_Error( 'invalid_email', __( 'Invalid email address.' ) ); |
| … |
… |
function wp_create_user_request( $email_address = '', $action_name = '', $reques |
| 3354 | 3356 | return new WP_Error( 'duplicate_request', __( 'An incomplete request for this email address already exists.' ) ); |
| 3355 | 3357 | } |
| 3356 | 3358 | |
| | 3359 | if ( 'yes' === $request_confirmation ) { |
| | 3360 | $status = 'request-pending'; |
| | 3361 | } else { |
| | 3362 | $status = 'request-skipped'; |
| | 3363 | } |
| | 3364 | |
| 3357 | 3365 | $request_id = wp_insert_post( |
| 3358 | 3366 | array( |
| 3359 | 3367 | 'post_author' => $user_id, |
| 3360 | 3368 | 'post_name' => $action_name, |
| 3361 | 3369 | 'post_title' => $email_address, |
| 3362 | 3370 | 'post_content' => wp_json_encode( $request_data ), |
| 3363 | | 'post_status' => 'request-pending', |
| | 3371 | 'post_status' => $status, |
| 3364 | 3372 | 'post_type' => 'user_request', |
| 3365 | 3373 | 'post_date' => current_time( 'mysql', false ), |
| 3366 | 3374 | 'post_date_gmt' => current_time( 'mysql', true ), |