Changeset 50230 for trunk/src/wp-admin/includes/privacy-tools.php
- Timestamp:
- 02/05/2021 03:48:59 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/privacy-tools.php
r50165 r50230 112 112 $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) ); 113 113 $email_address = ''; 114 $s end_confirmation_email = true;114 $status = 'pending'; 115 115 116 116 if ( ! isset( $_POST['send_confirmation_email'] ) ) { 117 $s end_confirmation_email = false;117 $status = 'confirmed'; 118 118 } 119 119 … … 147 147 } 148 148 149 $request_id = wp_create_user_request( $email_address, $action_type, array(), $send_confirmation_email ); 149 $request_id = wp_create_user_request( $email_address, $action_type, array(), $status ); 150 $message = ''; 150 151 151 152 if ( is_wp_error( $request_id ) ) { 153 $message = $request_id->get_error_message(); 154 } elseif ( ! $request_id ) { 155 $message = __( 'Unable to initiate confirmation request.' ); 156 } 157 158 if ( $message ) { 152 159 add_settings_error( 153 160 'username_or_email_for_privacy_request', 154 161 'username_or_email_for_privacy_request', 155 $request_id->get_error_message(), 156 'error' 157 ); 158 break; 159 } elseif ( ! $request_id ) { 160 add_settings_error( 161 'username_or_email_for_privacy_request', 162 'username_or_email_for_privacy_request', 163 __( 'Unable to initiate confirmation request.' ), 162 $message, 164 163 'error' 165 164 ); … … 167 166 } 168 167 169 if ( $send_confirmation_email) {168 if ( 'pending' === $status ) { 170 169 wp_send_user_request( $request_id ); 170 171 $message = __( 'Confirmation request initiated successfully.' ); 172 } elseif ( 'confirmed' === $status ) { 173 $message = __( 'Request added successfully.' ); 171 174 } 172 175 173 add_settings_error( 174 'username_or_email_for_privacy_request', 175 'username_or_email_for_privacy_request', 176 __( 'Confirmation request initiated successfully.' ), 177 'success' 178 ); 179 break; 176 if ( $message ) { 177 add_settings_error( 178 'username_or_email_for_privacy_request', 179 'username_or_email_for_privacy_request', 180 $message, 181 'success' 182 ); 183 break; 184 } 180 185 } 181 186 }
Note: See TracChangeset
for help on using the changeset viewer.