Ticket #43890: 43890.4.diff
File 43890.4.diff, 8.2 KB (added by , 4 years ago) |
---|
-
src/wp-admin/css/forms.css
1330 1330 margin: 1.5em 0; 1331 1331 } 1332 1332 1333 .wp-privacy-request-form label {1334 font-weight: 600;1335 line-height: 1.5;1336 padding-bottom: .5em;1337 display: block;1338 }1339 1340 1333 .wp-privacy-request-form input { 1341 1334 margin: 0; 1342 1335 } -
src/wp-admin/erase-personal-data.php
58 58 59 59 <form action="<?php echo esc_url( admin_url( 'erase-personal-data.php' ) ); ?>" method="post" class="wp-privacy-request-form"> 60 60 <h2><?php esc_html_e( 'Add Data Erasure Request' ); ?></h2> 61 <p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>62 63 61 <div class="wp-privacy-request-form-field"> 64 <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label> 65 <input type="text" required class="regular-text ltr" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" /> 66 <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?> 62 <table class="form-table"> 63 <tr> 64 <th scope="row"> 65 <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label> 66 </th> 67 <td> 68 <input type="text" required class="regular-text ltr" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" /> 69 </td> 70 </tr> 71 <tr> 72 <th scope="row"> 73 <?php _e( 'Confirmation email' ); ?> 74 </th> 75 <td> 76 <label for="send_confirmation_email"> 77 <input type="checkbox" name="send_confirmation_email" id="send_confirmation_email" value="1" checked="checked" /> 78 <?php _e( 'Send personal data erasure confirmation email.' ); ?> 79 </label> 80 </td> 81 </tr> 82 </table> 83 <p class="submit"> 84 <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?> 85 </p> 67 86 </div> 68 87 <?php wp_nonce_field( 'personal-data-request' ); ?> 69 88 <input type="hidden" name="action" value="add_remove_personal_data_request" /> -
src/wp-admin/export-personal-data.php
58 58 59 59 <form action="<?php echo esc_url( admin_url( 'export-personal-data.php' ) ); ?>" method="post" class="wp-privacy-request-form"> 60 60 <h2><?php esc_html_e( 'Add Data Export Request' ); ?></h2> 61 <p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>62 63 61 <div class="wp-privacy-request-form-field"> 64 <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label> 65 <input type="text" required class="regular-text ltr" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" /> 66 <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?> 62 <table class="form-table"> 63 <tr> 64 <th scope="row"> 65 <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label> 66 </th> 67 <td> 68 <input type="text" required class="regular-text ltr" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" /> 69 </td> 70 </tr> 71 <tr> 72 <th scope="row"> 73 <?php _e( 'Confirmation email' ); ?> 74 </th> 75 <td> 76 <label for="send_confirmation_email"> 77 <input type="checkbox" name="send_confirmation_email" id="send_confirmation_email" value="1" checked="checked" /> 78 <?php _e( 'Send personal data export confirmation email.' ); ?> 79 </label> 80 </td> 81 </tr> 82 </table> 83 <p class="submit"> 84 <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?> 85 </p> 67 86 </div> 68 87 <?php wp_nonce_field( 'personal-data-request' ); ?> 69 88 <input type="hidden" name="action" value="add_export_personal_data_request" /> -
src/wp-admin/includes/privacy-tools.php
54 54 55 55 update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); 56 56 57 if ( get_post_status( $request_id ) === 'request-skipped' ) { 58 return; 59 } 60 57 61 $result = wp_update_post( 58 62 array( 59 63 'ID' => $request_id, … … 111 115 $action_type = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) ); 112 116 $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) ); 113 117 $email_address = ''; 118 $send_confirmation_email = true; 114 119 120 if ( ! isset( $_POST['send_confirmation_email'] ) ) { 121 $send_confirmation_email = false; 122 } 123 115 124 if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) { 116 125 add_settings_error( 117 126 'action_type', … … 141 150 break; 142 151 } 143 152 144 $request_id = wp_create_user_request( $email_address, $action_type );153 $request_id = wp_create_user_request( $email_address, $action_type, array(), $send_confirmation_email ); 145 154 146 155 if ( is_wp_error( $request_id ) ) { 147 156 add_settings_error( … … 161 170 break; 162 171 } 163 172 164 wp_send_user_request( $request_id ); 173 if ( $send_confirmation_email ) { 174 wp_send_user_request( $request_id ); 175 } 165 176 166 177 add_settings_error( 167 178 'username_or_email_for_privacy_request', -
src/wp-includes/user.php
3770 3770 * 3771 3771 * @since 4.9.6 3772 3772 * 3773 * @param string $email_address User email address. This can be the address of a registered or non-registered user. 3774 * @param string $action_name Name of the action that is being confirmed. Required. 3775 * @param array $request_data Misc data you want to send with the verification request and pass to the actions once the request is confirmed. 3776 * @return int|WP_Error Returns the request ID if successful, or a WP_Error object on failure. 3773 * @param string $email_address User email address. This can be the address of a registered or non-registered user. 3774 * @param string $action_name Name of the action that is being confirmed. Required. 3775 * @param array $request_data Misc data you want to send with the verification request and pass to the actions once the request is confirmed. 3776 * @param bool $send_confirmation_email Optional. True by default, if false is passed the request status is set to Completed directly. 3777 * @return int|WP_Error Returns the request ID if successful, or a WP_Error object on failure. 3777 3778 */ 3778 function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array() ) {3779 function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array(), $send_confirmation_email = true ) { 3779 3780 $email_address = sanitize_email( $email_address ); 3780 3781 $action_name = sanitize_key( $action_name ); 3781 3782 … … 3808 3809 return new WP_Error( 'duplicate_request', __( 'An incomplete user privacy request for this email address already exists.' ) ); 3809 3810 } 3810 3811 3812 if ( $send_confirmation_email ) { 3813 $status = 'request-pending'; 3814 } else { 3815 $status = 'request-completed'; 3816 } 3817 3811 3818 $request_id = wp_insert_post( 3812 3819 array( 3813 3820 'post_author' => $user_id, … … 3814 3821 'post_name' => $action_name, 3815 3822 'post_title' => $email_address, 3816 3823 'post_content' => wp_json_encode( $request_data ), 3817 'post_status' => 'request-pending',3824 'post_status' => $status, 3818 3825 'post_type' => 'user_request', 3819 3826 'post_date' => current_time( 'mysql', false ), 3820 3827 'post_date_gmt' => current_time( 'mysql', true ),