wppaste
WordPress

_wp_privacy_send_request_confirmation_notification( int $request_id )

Since
4.9.6
Source
wp-includes/user.php:4182
Notifies the site administrator via email when a request is confirmed.

Description

Without this, the admin would have to manually check the site to see if any action was needed on their part yet.

Compatibility

WordPress
since 4.9.6
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Parameters

$request_idint
The ID of the request.

Performance profile

How much work a call to _wp_privacy_send_request_confirmation_notification() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Expensive

Sends mail via wp_mail().

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
8–160

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 167.

Plugin surface
5 hooks

Third-party callbacks on 'user_request_confirmed_email_to', 'user_request_confirmed_email_subject', 'user_confirmed_action_email_content' run inside this call, and their cost is not bounded by anything here.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • hookthird-party callbacksapply_filters()called directly
  • optionnetwork optionget_site_option()called directly
  • mailsends mailwp_mail()called directly
  • querycontent queryget_post()one call below _wp_privacy_send_request_confirmation_notification()
  • cacheobject cachewp_cache_get()one call below _wp_privacy_send_request_confirmation_notification()
  • serializeserialisationmaybe_unserialize()one call below _wp_privacy_send_request_confirmation_notification()

Further down the call graph this can also reach transient. That is the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 6 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost _wp_privacy_send_request_confirmation_notification() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always8–11wp_get_user_request()
$request instanceof18wp_get_user_request(), get_post_meta()
$request instanceof151wp_get_user_request(), get_post_meta(), wp_user_request_action_description(), get_site_option(), apply_filters(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), sanitize_url(), apply_filters(), wp_mail()
$request instanceof153–155wp_get_user_request(), get_post_meta(), admin_url(), wp_user_request_action_description(), get_site_option(), apply_filters(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), sanitize_url(), apply_filters(), wp_mail()
$request instanceof156wp_get_user_request(), get_post_meta(), wp_user_request_action_description(), get_site_option(), apply_filters(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), sanitize_url(), apply_filters(), wp_mail(), update_post_meta()
$request instanceof158–160wp_get_user_request(), get_post_meta(), admin_url(), wp_user_request_action_description(), get_site_option(), apply_filters(), get_option(), wp_specialchars_decode(), home_url(), __(), sprintf(), apply_filters(), __(), __(), sprintf(), apply_filters(), sanitize_url(), sanitize_url(), apply_filters(), wp_mail(), update_post_meta()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev1678–1606
8.51678–1606
8.41678–160615 fewer instructions than PHP 8.3
8.31828–1756
8.21828–1756
8.11828–1756
7.41828–1756

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Hooks and filters fired · 5

5 hooks fire while _wp_privacy_send_request_confirmation_notification() runs, in this order:

  1. apply_filters( user_request_confirmed_email_to )filterline 4216 (+34 into the body)

    Filters the recipient of the data request confirmation notification.

  2. apply_filters( user_request_confirmed_email_subject )filterline 4254 (+72 into the body)

    Filters the subject of the user request confirmation email.

  3. do_action( user_confirmed_action_email_content )filter_deprecatedline 4306 (+124 into the body)

    Filters the body of the user request confirmation email.

  4. apply_filters( user_request_confirmed_email_content )filterline 4345 (+163 into the body)

    Filters the body of the user request confirmation email.

  5. apply_filters( user_request_confirmed_email_headers )filterline 4376 (+194 into the body)

    Filters the headers of the user request confirmation email.

Uses · 14

Show all 14

Source code

<?phpfunction _wp_privacy_send_request_confirmation_notification( $request_id ) {	$request = wp_get_user_request( $request_id ); 	if ( ! ( $request instanceof WP_User_Request ) || 'request-confirmed' !== $request->status ) {		return;	} 	$already_notified = (bool) get_post_meta( $request_id, '_wp_admin_notified', true ); 	if ( $already_notified ) {		return;	} 	if ( 'export_personal_data' === $request->action_name ) {		$manage_url = admin_url( 'export-personal-data.php' );	} elseif ( 'remove_personal_data' === $request->action_name ) {		$manage_url = admin_url( 'erase-personal-data.php' );	}	$action_description = wp_user_request_action_description( $request->action_name ); 	/**	 * Filters the recipient of the data request confirmation notification.	 *	 * In a Multisite environment, this will default to the email address of the	 * network admin because, by default, single site admins do not have the	 * capabilities required to process requests. Some networks may wish to	 * delegate those capabilities to a single-site admin, or a dedicated person	 * responsible for managing privacy requests.	 *	 * @since 4.9.6	 *	 * @param string          $admin_email The email address of the notification recipient.	 * @param WP_User_Request $request     The request that is initiating the notification.	 */	$admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request ); 	$email_data = array(		'request'     => $request,		'user_email'  => $request->email,		'description' => $action_description,		'manage_url'  => $manage_url,		'sitename'    => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),		'siteurl'     => home_url(),		'admin_email' => $admin_email,	); 	$subject = sprintf(		/* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */		__( '[%1$s] Action Confirmed: %2$s' ),		$email_data['sitename'],		$action_description	); 	/**	 * Filters the subject of the user request confirmation email.	 *	 * @since 4.9.8	 *	 * @param string $subject    The email subject.	 * @param string $sitename   The name of the site.	 * @param array  $email_data {	 *     Data relating to the account action email.	 *	 *     @type WP_User_Request $request     User request object.	 *     @type string          $user_email  The email address confirming a request.	 *     @type string          $description Description of the action being performed so the user knows what the email is for.	 *     @type string          $manage_url  The link to click manage privacy requests of this type.	 *     @type string          $sitename    The site name sending the mail.	 *     @type string          $siteurl     The site URL sending the mail.	 *     @type string          $admin_email The administrator email receiving the mail.	 * }	 */	$subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data ); 	/* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */	$content = __(		'Howdy, A user data privacy request has been confirmed on ###SITENAME###: 

Changelog

Introduced in 4.9.6. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/user.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.