Ticket #46303: 46303.3.diff
File 46303.3.diff, 5.6 KB (added by , 6 years ago) |
---|
-
src/wp-admin/includes/file.php
2346 2346 * @return true|WP_Error True on success or `WP_Error` on failure. 2347 2347 */ 2348 2348 function wp_privacy_send_personal_data_export_email( $request_id ) { 2349 // Get the request data.2350 2349 $request = wp_get_user_request_data( $request_id ); 2351 2350 2352 2351 if ( ! $request || 'export_personal_data' !== $request->action_name ) { … … 2356 2355 /** This filter is documented in wp-includes/functions.php */ 2357 2356 $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); 2358 2357 $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration ); 2358 $export_file_url = get_post_meta( $request_id, '_export_file_url', true ); 2359 $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 2360 $site_url = home_url(); 2359 2361 2362 /** 2363 * Filters the recipient of the personal data export email notification. 2364 * 2365 * @since 5.3.0 2366 * 2367 * @param string $request_email The email address of the notification recipient. 2368 * @param WP_User_Request $request The request that is initiating the notification. 2369 */ 2370 $request_email = apply_filters( 'wp_privacy_personal_data_email_to', $request->email, $request ); 2371 2372 $email_data = array( 2373 'request' => $request, 2374 'expiration' => $expiration, 2375 'expiration_date' => $expiration_date, 2376 'message_recipient' => $request_email, 2377 'export_file_url' => $export_file_url, 2378 'sitename' => $site_name, 2379 'siteurl' => $site_url, 2380 ); 2381 2382 $subject = sprintf( 2383 /* translators: %s: Site name. */ 2384 __( '[%s] Personal Data Export' ), 2385 $site_name 2386 ); 2387 2388 /** 2389 * Filters the subject of the email sent when an export request is completed. 2390 * 2391 * @since 4.9.8 2392 * 2393 * @param string $subject The email subject. 2394 * @param string $sitename The name of the site. 2395 * @param array $email_data { 2396 * Data relating to the account action email. 2397 * 2398 * @type WP_User_Request $request User request object. 2399 * @type int $expiration The time in seconds until the export file expires. 2400 * @type string $expiration_date The localized date and time when the export file expires. 2401 * @type string $message_recipient The address that the email will be sent to. Defaults 2402 * to the value of `$request->email`, but can be changed 2403 * by the `wp_privacy_personal_data_email_to` filter. 2404 * @type string $export_file_url The export file URL. 2405 * @type string $sitename The site name sending the mail. 2406 * @type string $siteurl The site URL sending the mail. 2407 * } 2408 */ 2409 $subject = apply_filters( 'wp_privacy_personal_data_email_subject', $subject, $site_name, $email_data ); 2410 2360 2411 /* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */ 2361 2412 $email_text = __( 2362 2413 'Howdy, … … 2383 2434 * ###SITEURL### The URL to the site. 2384 2435 * 2385 2436 * @since 4.9.6 2437 * @since 5.3.0 Introduced the $email_data array. 2386 2438 * 2387 2439 * @param string $email_text Text in the email. 2388 2440 * @param int $request_id The request ID for this personal data export. 2441 * @param array $email_data { 2442 * Data relating to the account action email. 2443 * 2444 * @type WP_User_Request $request User request object. 2445 * @type int $expiration The time in seconds until the export file expires. 2446 * @type string $expiration_date The localized date and time when the export file expires. 2447 * @type string $message_recipient The address that the email will be sent to. Defaults 2448 * to the value of `$request->email`, but can be changed 2449 * by the `wp_privacy_personal_data_email_to` filter. 2450 * @type string $export_file_url The export file URL. 2451 * @type string $sitename The site name sending the mail. 2452 * @type string $siteurl The site URL sending the mail. 2453 * } 2389 2454 */ 2390 $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id );2455 $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id, $email_data ); 2391 2456 2392 $email_address = $request->email;2393 $export_file_url = get_post_meta( $request_id, '_export_file_url', true );2394 $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );2395 $site_url = home_url();2396 2397 2457 $content = str_replace( '###EXPIRATION###', $expiration_date, $content ); 2398 2458 $content = str_replace( '###LINK###', esc_url_raw( $export_file_url ), $content ); 2399 $content = str_replace( '###EMAIL###', $ email_address, $content );2459 $content = str_replace( '###EMAIL###', $request_email, $content ); 2400 2460 $content = str_replace( '###SITENAME###', $site_name, $content ); 2401 2461 $content = str_replace( '###SITEURL###', esc_url_raw( $site_url ), $content ); 2402 2462 2403 $mail_success = wp_mail( 2404 $email_address, 2405 sprintf( 2406 __( '[%s] Personal Data Export' ), 2407 $site_name 2408 ), 2409 $content 2410 ); 2463 $mail_success = wp_mail( $request_email, $subject, $content ); 2411 2464 2412 2465 if ( ! $mail_success ) { 2413 2466 return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export email.' ) );