diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
index b00752e..f35aa0b 100644
|
|
function wp_privacy_generate_personal_data_export_file( $request_id ) { |
2184 | 2184 | } |
2185 | 2185 | |
2186 | 2186 | /** |
2187 | | * Send an email to the user with a link to the personal data export file |
| 2187 | * Send an email to the user with a link to the personal data export file, if available. |
2188 | 2188 | * |
2189 | 2189 | * @since 4.9.6 |
2190 | 2190 | * |
2191 | | * @param int $request_id The request ID for this personal data export. |
2192 | | * @return true|WP_Error True on success or `WP_Error` on failure. |
| 2191 | * @param int $request_id The request ID for this personal data export. |
| 2192 | * @param bool $has_export_data Whether there is any personal data to export. |
| 2193 | * @return true|WP_Error True on success or `WP_Error` on failure. |
2193 | 2194 | */ |
2194 | | function wp_privacy_send_personal_data_export_email( $request_id ) { |
| 2195 | function wp_privacy_send_personal_data_export_email( $request_id, $has_export_data = true ) { |
2195 | 2196 | // Get the request data. |
2196 | 2197 | $request = wp_get_user_request_data( $request_id ); |
2197 | 2198 | |
… |
… |
function wp_privacy_send_personal_data_export_email( $request_id ) { |
2203 | 2204 | $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); |
2204 | 2205 | $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration ); |
2205 | 2206 | |
2206 | | /* translators: Do not translate EXPIRATION, LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */ |
2207 | | $email_text = __( |
| 2207 | if ( $has_export_data ) { |
| 2208 | |
| 2209 | /* translators: Do not translate EXPIRATION, LINK, EMAIL, SITENAME, SITEURL: those are placeholders. */ |
| 2210 | $email_text = __( |
2208 | 2211 | 'Howdy, |
2209 | 2212 | |
2210 | 2213 | Your request for an export of personal data has been completed. You may |
… |
… |
All at ###SITENAME### |
2221 | 2224 | ###SITEURL###' |
2222 | 2225 | ); |
2223 | 2226 | |
| 2227 | } else { |
| 2228 | |
| 2229 | /* translators: Do not translate EMAIL, SITENAME, SITEURL: those are placeholders. */ |
| 2230 | $email_text = __( |
| 2231 | 'Howdy, |
| 2232 | |
| 2233 | Your request for an export of personal data has been completed. |
| 2234 | |
| 2235 | No personal data was found. |
| 2236 | |
| 2237 | This email has been sent to ###EMAIL###. |
| 2238 | |
| 2239 | Regards, |
| 2240 | All at ###SITENAME### |
| 2241 | ###SITEURL###' |
| 2242 | ); |
| 2243 | } |
| 2244 | |
2224 | 2245 | /** |
2225 | 2246 | * Filters the text of the email sent with a personal data export file. |
2226 | 2247 | * |
… |
… |
All at ###SITENAME### |
2233 | 2254 | * |
2234 | 2255 | * @since 4.9.6 |
2235 | 2256 | * |
2236 | | * @param string $email_text Text in the email. |
2237 | | * @param int $request_id The request ID for this personal data export. |
| 2257 | * @param string $email_text Text in the email. |
| 2258 | * @param int $request_id The request ID for this personal data export. |
| 2259 | * @param bool $has_export_data Whether there is any personal data to export. |
2238 | 2260 | */ |
2239 | | $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id ); |
| 2261 | $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id, $has_export_data ); |
2240 | 2262 | |
2241 | 2263 | $email_address = $request->email; |
2242 | 2264 | $export_file_url = get_post_meta( $request_id, '_export_file_url', true ); |
… |
… |
function wp_privacy_process_personal_data_export_page( $response, $exporter_inde |
2356 | 2378 | delete_post_meta( $request_id, '_export_data_raw' ); |
2357 | 2379 | update_post_meta( $request_id, '_export_data_grouped', $groups ); |
2358 | 2380 | |
2359 | | // Generate the export file from the collected, grouped personal data. |
2360 | | do_action( 'wp_privacy_personal_data_export_file', $request_id ); |
| 2381 | $has_export_data = ! empty( $groups ); |
| 2382 | |
| 2383 | if ( $has_export_data ) { |
| 2384 | // Generate the export file from the collected, grouped personal data. |
| 2385 | do_action( 'wp_privacy_personal_data_export_file', $request_id ); |
| 2386 | } |
2361 | 2387 | |
2362 | 2388 | // Clear the grouped data now that it is no longer needed. |
2363 | 2389 | delete_post_meta( $request_id, '_export_data_grouped' ); |
2364 | 2390 | |
2365 | 2391 | // If the destination is email, send it now. |
2366 | 2392 | if ( $send_as_email ) { |
2367 | | $mail_success = wp_privacy_send_personal_data_export_email( $request_id ); |
| 2393 | $mail_success = wp_privacy_send_personal_data_export_email( $request_id, $has_export_data ); |
2368 | 2394 | if ( is_wp_error( $mail_success ) ) { |
2369 | 2395 | wp_send_json_error( $mail_success->get_error_message() ); |
2370 | 2396 | } |
2371 | | } else { |
| 2397 | } elseif ( $has_export_data ) { |
2372 | 2398 | // Modify the response to include the URL of the export file so the browser can fetch it. |
2373 | 2399 | $export_file_url = get_post_meta( $request_id, '_export_file_url', true ); |
2374 | 2400 | if ( ! empty( $export_file_url ) ) { |