<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[50159] trunk: Privacy: Allow Admin to Skip e-mail confirmation for Export.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/50159">50159</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/50159","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>antpb</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-02-02 19:43:37 +0000 (Tue, 02 Feb 2021)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Privacy: Allow Admin to Skip e-mail confirmation for Export.

This adds a form option to skip the admin email alert when exporting personal data.

Props xkon, azaozz, TZ-Media, iandunn, desrosj, iprg, allendav, wesselvandenberg, karmatosed, birgire, davidbaumwald, estelaris, paaljoachim, hellofromTonya.
Fixes <a href="https://core.trac.wordpress.org/ticket/43890">#43890</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincssformscss">trunk/src/wp-admin/css/forms.css</a></li>
<li><a href="#trunksrcwpadminerasepersonaldataphp">trunk/src/wp-admin/erase-personal-data.php</a></li>
<li><a href="#trunksrcwpadminexportpersonaldataphp">trunk/src/wp-admin/export-personal-data.php</a></li>
<li><a href="#trunksrcwpadminincludesprivacytoolsphp">trunk/src/wp-admin/includes/privacy-tools.php</a></li>
<li><a href="#trunksrcwpincludesuserphp">trunk/src/wp-includes/user.php</a></li>
<li><a href="#trunktestsphpunittestsprivacywpCreateUserRequestphp">trunk/tests/phpunit/tests/privacy/wpCreateUserRequest.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincssformscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/forms.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/forms.css  2021-02-02 19:38:16 UTC (rev 50158)
+++ trunk/src/wp-admin/css/forms.css    2021-02-02 19:43:37 UTC (rev 50159)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1330,13 +1330,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 1.5em 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.wp-privacy-request-form label {
-       font-weight: 600;
-       line-height: 1.5;
-       padding-bottom: .5em;
-       display: block;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> .wp-privacy-request-form input {
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminerasepersonaldataphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/erase-personal-data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/erase-personal-data.php        2021-02-02 19:38:16 UTC (rev 50158)
+++ trunk/src/wp-admin/erase-personal-data.php  2021-02-02 19:43:37 UTC (rev 50159)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -109,12 +109,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <form action="<?php echo esc_url( admin_url( 'erase-personal-data.php' ) ); ?>" method="post" class="wp-privacy-request-form">
</span><span class="cx" style="display: block; padding: 0 10px">                <h2><?php esc_html_e( 'Add Data Erasure Request' ); ?></h2>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>
-
</del><span class="cx" style="display: block; padding: 0 10px">                 <div class="wp-privacy-request-form-field">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
-                       <input type="text" required class="regular-text ltr" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" />
-                       <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <table class="form-table">
+                               <tr>
+                                       <th scope="row">
+                                               <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
+                                       </th>
+                                       <td>
+                                               <input type="text" required class="regular-text ltr" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" />
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <th scope="row">
+                                               <?php _e( 'Confirmation email' ); ?>
+                                       </th>
+                                       <td>
+                                               <label for="send_confirmation_email">
+                                                       <input type="checkbox" name="send_confirmation_email" id="send_confirmation_email" value="1" checked="checked" />
+                                                       <?php _e( 'Send personal data erasure confirmation email.' ); ?>
+                                               </label>
+                                       </td>
+                               </tr>
+                       </table>
+                       <p class="submit">
+                               <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
+                       </p>
</ins><span class="cx" style="display: block; padding: 0 10px">                 </div>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php wp_nonce_field( 'personal-data-request' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <input type="hidden" name="action" value="add_remove_personal_data_request" />
</span></span></pre></div>
<a id="trunksrcwpadminexportpersonaldataphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/export-personal-data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/export-personal-data.php       2021-02-02 19:38:16 UTC (rev 50158)
+++ trunk/src/wp-admin/export-personal-data.php 2021-02-02 19:43:37 UTC (rev 50159)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -109,12 +109,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <form action="<?php echo esc_url( admin_url( 'export-personal-data.php' ) ); ?>" method="post" class="wp-privacy-request-form">
</span><span class="cx" style="display: block; padding: 0 10px">                <h2><?php esc_html_e( 'Add Data Export Request' ); ?></h2>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>
-
</del><span class="cx" style="display: block; padding: 0 10px">                 <div class="wp-privacy-request-form-field">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
-                       <input type="text" required class="regular-text ltr" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" />
-                       <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <table class="form-table">
+                               <tr>
+                                       <th scope="row">
+                                               <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
+                                       </th>
+                                       <td>
+                                               <input type="text" required class="regular-text ltr" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" />
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <th scope="row">
+                                               <?php _e( 'Confirmation email' ); ?>
+                                       </th>
+                                       <td>
+                                               <label for="send_confirmation_email">
+                                                       <input type="checkbox" name="send_confirmation_email" id="send_confirmation_email" value="1" checked="checked" />
+                                                       <?php _e( 'Send personal data export confirmation email.' ); ?>
+                                               </label>
+                                       </td>
+                               </tr>
+                       </table>
+                       <p class="submit">
+                               <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
+                       </p>
</ins><span class="cx" style="display: block; padding: 0 10px">                 </div>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php wp_nonce_field( 'personal-data-request' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <input type="hidden" name="action" value="add_export_personal_data_request" />
</span></span></pre></div>
<a id="trunksrcwpadminincludesprivacytoolsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/privacy-tools.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/privacy-tools.php     2021-02-02 19:38:16 UTC (rev 50158)
+++ trunk/src/wp-admin/includes/privacy-tools.php       2021-02-02 19:43:37 UTC (rev 50159)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -111,7 +111,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $action_type               = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                $email_address             = '';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $send_confirmation_email   = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                if ( ! isset( $_POST['send_confirmation_email'] ) ) {
+                                       $send_confirmation_email   = false;
+                               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        add_settings_error(
</span><span class="cx" style="display: block; padding: 0 10px">                                                'action_type',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -141,7 +146,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        break;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $request_id = wp_create_user_request( $email_address, $action_type );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $request_id = wp_create_user_request( $email_address, $action_type, array(), $send_confirmation_email );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( is_wp_error( $request_id ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        add_settings_error(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -161,7 +166,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        break;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                wp_send_user_request( $request_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $send_confirmation_email ) {
+                                       wp_send_user_request( $request_id );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                add_settings_error(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'username_or_email_for_privacy_request',
</span></span></pre></div>
<a id="trunksrcwpincludesuserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/user.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/user.php    2021-02-02 19:38:16 UTC (rev 50158)
+++ trunk/src/wp-includes/user.php      2021-02-02 19:43:37 UTC (rev 50159)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3937,12 +3937,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 4.9.6
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $email_address User email address. This can be the address of a registered or non-registered user.
- * @param string $action_name   Name of the action that is being confirmed. Required.
- * @param array  $request_data  Misc data you want to send with the verification request and pass to the actions once the request is confirmed.
- * @return int|WP_Error Returns the request ID if successful, or a WP_Error object on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $email_address           User email address. This can be the address of a registered or non-registered user.
+ * @param string $action_name             Name of the action that is being confirmed. Required.
+ * @param array  $request_data            Misc data you want to send with the verification request and pass to the actions once the request is confirmed.
+ * @param bool   $send_confirmation_email Optional. True by default, if false is passed the request status is set to Completed directly.
+ * @return int|WP_Error                   Returns the request ID if successful, or a WP_Error object on failure.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array(), $send_confirmation_email = true ) {
</ins><span class="cx" style="display: block; padding: 0 10px">         $email_address = sanitize_email( $email_address );
</span><span class="cx" style="display: block; padding: 0 10px">        $action_name   = sanitize_key( $action_name );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3975,6 +3976,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return new WP_Error( 'duplicate_request', __( 'An incomplete personal data request for this email address already exists.' ) );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        if ( false !== $send_confirmation_email ) {
+               $status = 'request-pending';
+       } else {
+               $status = 'request-completed';
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         $request_id = wp_insert_post(
</span><span class="cx" style="display: block; padding: 0 10px">                array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_author'   => $user_id,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3981,7 +3988,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_name'     => $action_name,
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_title'    => $email_address,
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_content'  => wp_json_encode( $request_data ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'post_status'   => 'request-pending',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'post_status'   => $status,
</ins><span class="cx" style="display: block; padding: 0 10px">                         'post_type'     => 'user_request',
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_date'     => current_time( 'mysql', false ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_date_gmt' => current_time( 'mysql', true ),
</span></span></pre></div>
<a id="trunktestsphpunittestsprivacywpCreateUserRequestphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/privacy/wpCreateUserRequest.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/privacy/wpCreateUserRequest.php 2021-02-02 19:38:16 UTC (rev 50158)
+++ trunk/tests/phpunit/tests/privacy/wpCreateUserRequest.php   2021-02-02 19:43:37 UTC (rev 50159)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -308,4 +308,46 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertWPError( $actual );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'empty_content', $actual->get_error_code() );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Test that the request has a Pending status if a confirmation email is sent.
+        *
+        * @ticket 43890
+        */
+       public function test_pending_status_with_default_wp_create_user_request_params() {
+               $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data' );
+               $post   = get_post( $actual );
+
+               $this->assertSame( 'request-pending', $post->post_status );
+       }
+
+       /**
+        * Test that the request has a Pending status if the $send_confirmation_email param is true.
+        *
+        * @ticket 43890
+        */
+       public function test_pending_status_with_true_send_confirmation_email() {
+               $request_data            = array();
+               $send_confirmation_email = true;
+
+               $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data', $request_data, $send_confirmation_email );
+               $post   = get_post( $actual );
+
+               $this->assertSame( 'request-pending', $post->post_status );
+       }
+
+       /**
+        * Test that the request has a Completed status if the $send_confirmation_email param is false.
+        *
+        * @ticket 43890
+        */
+       public function test_pending_status_with_false_send_confirmation_email() {
+               $request_data                    = array();
+               $send_confirmation_email = false;
+
+               $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data', $request_data, $send_confirmation_email );
+               $post   = get_post( $actual );
+
+               $this->assertSame( 'request-completed', $post->post_status );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>

</body>
</html>