WordPress.org

Make WordPress Core

Ticket #43890: 43890.3.diff

File 43890.3.diff, 9.1 KB (added by xkon, 14 months ago)

refresh

  • src/wp-admin/css/forms.css

    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 { 
    12101210        line-height: 1.5;
    12111211        margin: 0;
    12121212}
     1213.wp-privacy-request-form select {
     1214        margin-top: -4px;
     1215}
    12131216
    12141217.email-personal-data::before {
    12151218        display: inline-block;
  • src/wp-admin/erase-personal-data.php

    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' ); 
    6363                <div class="wp-privacy-request-form-field">
    6464                        <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
    6565                        <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>
    6670                        <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
    6771                </div>
    6872                <?php wp_nonce_field( 'personal-data-request' ); ?>
  • src/wp-admin/export-personal-data.php

    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' ); 
    6363                <div class="wp-privacy-request-form-field">
    6464                        <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
    6565                        <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>
    6670                        <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
    6771                </div>
    6872                <?php wp_nonce_field( 'personal-data-request' ); ?>
  • src/wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php

    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 
    111111                                submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
    112112                                break;
    113113                        case 'request-completed':
     114                        case 'request-skipped':
    114115                                echo '<a href="' . esc_url(
    115116                                        wp_nonce_url(
    116117                                                add_query_arg(
  • src/wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php

    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 
    116116                                submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
    117117                                break;
    118118                        case 'request-completed':
     119                        case 'request-skipped':
    119120                                echo '<a href="' . esc_url(
    120121                                        wp_nonce_url(
    121122                                                add_query_arg(
  • src/wp-admin/includes/class-wp-privacy-requests-table.php

    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 { 
    350350                                $timestamp = $item->confirmed_timestamp;
    351351                                break;
    352352                        case 'request-completed':
     353                        case 'request-skipped':
    353354                                $timestamp = $item->completed_timestamp;
    354355                                break;
    355356                }
  • src/wp-admin/includes/privacy-tools.php

    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 ) { 
    5353
    5454        update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() );
    5555
     56        if ( get_post_status( $request_id ) === 'request-skipped' ) {
     57                return;
     58        }
     59
    5660        $result = wp_update_post(
    5761                array(
    5862                        'ID'          => $request_id,
    function _wp_personal_data_handle_actions() { 
    110114                                $action_type               = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) );
    111115                                $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) );
    112116                                $email_address             = '';
     117                                $request_confirmation      = sanitize_text_field( $_POST['request_confirmation'] );
    113118
    114119                                if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) {
    115120                                        add_settings_error(
    function _wp_personal_data_handle_actions() { 
    140145                                        break;
    141146                                }
    142147
    143                                 $request_id = wp_create_user_request( $email_address, $action_type );
     148                                $request_id = wp_create_user_request( $email_address, $action_type, $request_confirmation );
    144149
    145150                                if ( is_wp_error( $request_id ) ) {
    146151                                        add_settings_error(
    function _wp_personal_data_handle_actions() { 
    160165                                        break;
    161166                                }
    162167
    163                                 wp_send_user_request( $request_id );
     168                                if ( 'yes' === $request_confirmation ) {
     169                                        wp_send_user_request( $request_id );
     170                                }
    164171
    165172                                add_settings_error(
    166173                                        'username_or_email_for_privacy_request',
  • src/wp-includes/post.php

    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() { 
    429429                        'exclude_from_search' => false,
    430430                )
    431431        );
     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        );
    432442}
    433443
    434444/**
  • src/wp-includes/user.php

    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 ) { 
    33163316 *
    33173317 * @since 4.9.6
    33183318 *
    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.
    33233324 */
    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 );
     3325function 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 );
    33273329
    33283330        if ( ! is_email( $email_address ) ) {
    33293331                return new WP_Error( 'invalid_email', __( 'Invalid email address.' ) );
    function wp_create_user_request( $email_address = '', $action_name = '', $reques 
    33543356                return new WP_Error( 'duplicate_request', __( 'An incomplete request for this email address already exists.' ) );
    33553357        }
    33563358
     3359        if ( 'yes' === $request_confirmation ) {
     3360                $status = 'request-pending';
     3361        } else {
     3362                $status = 'request-skipped';
     3363        }
     3364
    33573365        $request_id = wp_insert_post(
    33583366                array(
    33593367                        'post_author'   => $user_id,
    33603368                        'post_name'     => $action_name,
    33613369                        'post_title'    => $email_address,
    33623370                        'post_content'  => wp_json_encode( $request_data ),
    3363                         'post_status'   => 'request-pending',
     3371                        'post_status'   => $status,
    33643372                        'post_type'     => 'user_request',
    33653373                        'post_date'     => current_time( 'mysql', false ),
    33663374                        'post_date_gmt' => current_time( 'mysql', true ),