<!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>[42967] trunk/src: Privacy: add new wp-admin screens for exporting and removing of personal data.</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 { 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/42967">42967</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/42967","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-04-10 18:01:20 +0000 (Tue, 10 Apr 2018)</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: add new wp-admin screens for exporting and removing of personal data.

Props @melchoyce, @mikejolley, @allendav, @xkon.
See <a href="https://core.trac.wordpress.org/ticket/43481">#43481</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincssformscss">trunk/src/wp-admin/css/forms.css</a></li>
<li><a href="#trunksrcwpadminincludesadminfiltersphp">trunk/src/wp-admin/includes/admin-filters.php</a></li>
<li><a href="#trunksrcwpadminincludesuserphp">trunk/src/wp-admin/includes/user.php</a></li>
<li><a href="#trunksrcwpincludespostphp">trunk/src/wp-includes/post.php</a></li>
<li><a href="#trunksrcwpincludesuserphp">trunk/src/wp-includes/user.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  2018-04-10 16:11:55 UTC (rev 42966)
+++ trunk/src/wp-admin/css/forms.css    2018-04-10 18:01:20 UTC (rev 42967)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1403,3 +1403,103 @@
</span><span class="cx" style="display: block; padding: 0 10px">                margin-right: 0.5em;
</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">+
+
+/* Privacy */
+
+.privacy_requests .column-email {
+       width: 40%;
+}
+.privacy_requests .column-type {
+       text-align: center;
+}
+.privacy_requests thead td:first-child,
+.privacy_requests tfoot td:first-child {
+       border-left: 4px solid #fff;
+}
+.privacy_requests tbody th {
+       border-left: 4px solid #fff;
+       background: #fff;
+       box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
+}
+.privacy_requests tbody td {
+       background: #fff;
+       box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
+}
+.privacy_requests .status-request-confirmed th,
+.privacy_requests .status-request-confirmed td {
+       background-color: #f7fcfe;
+       border-left-color: #00a0d2;
+}
+.privacy_requests .status-request-failed th,
+.privacy_requests .status-request-failed td {
+       background-color: #fef7f1;
+       border-left-color: #d64d21;
+}
+.status-label {
+       font-weight: bold;
+}
+.status-label.status-request-pending {
+       font-weight: normal;
+       font-style: italic;
+       color: #6c7781;
+}
+.status-label.status-request-failed {
+       color: #aa0000;
+       font-weight: bold;
+}
+.wp-privacy-request-form {
+       clear: both;
+}
+.wp-privacy-request-form-field {
+       margin: 1.5em 0;
+}
+.wp-privacy-request-form label {
+       font-weight: bold;
+       line-height: 1.5;
+       padding-bottom: .5em;
+       display: block;
+}
+.wp-privacy-request-form input {
+       line-height: 1.5;
+       margin: 0;
+}
+.email-personal-data::before {
+       display: inline-block;
+       font: normal 20px/1 dashicons;
+       margin: 3px 5px 0 -2px;
+       speak: none;
+       -webkit-font-smoothing: antialiased;
+       -moz-osx-font-smoothing: grayscale;
+       vertical-align: top;
+}
+.email-personal-data--sending::before {
+       color: #f56e28;
+       content: "\f463";
+       -webkit-animation: rotation 2s infinite linear;
+       animation: rotation 2s infinite linear;
+}
+.email-personal-data--sent::before {
+       color: #79ba49;
+       content: "\f147";
+}
+@-webkit-keyframes rotation {
+       0% {
+               -webkit-transform: rotate(0deg);
+               transform: rotate(0deg);
+       }
+       100% {
+               -webkit-transform: rotate(359deg);
+               transform: rotate(359deg);
+       }
+}
+@keyframes rotation {
+       0% {
+               -webkit-transform: rotate(0deg);
+               transform: rotate(0deg);
+       }
+       100% {
+               -webkit-transform: rotate(359deg);
+               transform: rotate(359deg);
+       }
+}
</ins></span></pre></div>
<a id="trunksrcwpadminincludesadminfiltersphp"></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/admin-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/admin-filters.php     2018-04-10 16:11:55 UTC (rev 42966)
+++ trunk/src/wp-admin/includes/admin-filters.php       2018-04-10 18:01:20 UTC (rev 42967)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,6 +45,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_head', 'wp_site_icon' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_head', '_ipad_meta' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// Privacy tools
+add_action( 'account_action_failed', '_wp_privacy_account_request_failed' );
+add_action( 'admin_menu', '_wp_privacy_hook_requests_page' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Prerendering.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_customize_preview() ) {
</span><span class="cx" style="display: block; padding: 0 10px">        add_filter( 'admin_print_styles', 'wp_resource_hints', 1 );
</span></span></pre></div>
<a id="trunksrcwpadminincludesuserphp"></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/user.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/user.php      2018-04-10 16:11:55 UTC (rev 42966)
+++ trunk/src/wp-admin/includes/user.php        2018-04-10 18:01:20 UTC (rev 42967)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -579,3 +579,854 @@
</span><span class="cx" style="display: block; padding: 0 10px">                ), wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) )
</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">+
+/**
+ * Get action description from the name.
+ *
+ * @since 5.0.0
+ * @access private
+ *
+ * @return string
+ */
+function _wp_privacy_action_description( $request_type ) {
+       switch ( $request_type ) {
+               case 'user_export_request':
+                       return __( 'Export Personal Data' );
+               case 'user_remove_request':
+                       return __( 'Remove Personal Data' );
+       }
+}
+
+/**
+ * Log a request and send to the user.
+ *
+ * @since 5.0.0
+ * @access private
+ *
+ * @param string $email_address Email address sending the request to.
+ * @param string $action Action being requested.
+ * @param string $description Description of request.
+ * @return bool|WP_Error depending on success.
+ */
+function _wp_privacy_create_request( $email_address, $action, $description ) {
+       $user_id = 0;
+       $user    = get_user_by( 'email', $email_address );
+
+       if ( $user ) {
+               $user_id = $user->ID;
+       }
+
+       $privacy_request_id = wp_insert_post( array(
+               'post_author'   => $user_id,
+               'post_status'   => 'request-pending',
+               'post_type'     => $action,
+               'post_date'     => current_time( 'mysql', false ),
+               'post_date_gmt' => current_time( 'mysql', true ),
+       ), true );
+
+       if ( is_wp_error( $privacy_request_id ) ) {
+               return $privacy_request_id;
+       }
+
+       update_post_meta( $privacy_request_id, '_user_email', $email_address );
+       update_post_meta( $privacy_request_id, '_action_name', $action );
+       update_post_meta( $privacy_request_id, '_confirmed_timestamp', false );
+
+       return wp_send_account_verification_key( $email_address, $action, $description, array(
+               'privacy_request_id' => $privacy_request_id,
+       ) );
+}
+
+/**
+ * Resend an existing request and return the result.
+ *
+ * @since 5.0.0
+ * @access private
+ *
+ * @param int $privacy_request_id Request ID.
+ * @return bool|WP_Error
+ */
+function _wp_privacy_resend_request( $privacy_request_id ) {
+       $privacy_request_id = absint( $privacy_request_id );
+       $privacy_request    = get_post( $privacy_request_id );
+
+       if ( ! $privacy_request || ! in_array( $privacy_request->post_type, _wp_privacy_action_request_types(), true ) ) {
+               return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) );
+       }
+
+       $email_address = get_post_meta( $privacy_request_id, '_user_email', true );
+       $action        = get_post_meta( $privacy_request_id, '_action_name', true );
+       $description   = _wp_privacy_action_description( $action );
+       $result        = wp_send_account_verification_key( $email_address, $action, $description, array(
+               'privacy_request_id' => $privacy_request_id,
+       ) );
+
+       if ( is_wp_error( $result ) ) {
+               return $result;
+       } elseif ( ! $result ) {
+               return new WP_Error( 'privacy_request_error', __( 'Unable to initiate confirmation request.' ) );
+       }
+
+       wp_update_post( array(
+               'ID'            => $privacy_request_id,
+               'post_status'   => 'request-pending',
+               'post_date'     => current_time( 'mysql', false ),
+               'post_date_gmt' => current_time( 'mysql', true ),
+       ) );
+
+       return true;
+}
+
+/**
+ * Marks a request as completed by the admin and logs the datetime.
+ *
+ * @since 5.0.0
+ * @access private
+ *
+ * @param int $privacy_request_id Request ID.
+ * @return bool|WP_Error
+ */
+function _wp_privacy_completed_request( $privacy_request_id ) {
+       $privacy_request_id = absint( $privacy_request_id );
+       $privacy_request    = get_post( $privacy_request_id );
+
+       if ( ! $privacy_request || ! in_array( $privacy_request->post_type, _wp_privacy_action_request_types(), true ) ) {
+               return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) );
+       }
+
+       wp_update_post( array(
+               'ID'          => $privacy_request_id,
+               'post_status' => 'request-completed',
+       ) );
+
+       update_post_meta( $privacy_request_id, '_completed_timestamp', time() );
+}
+
+/**
+ * Handle list table actions.
+ *
+ * @since 5.0.0
+ * @access private
+ */
+function _wp_personal_data_handle_actions() {
+       if ( isset( $_POST['export_personal_data_email_retry'] ) ) { // WPCS: input var ok.
+               check_admin_referer( 'bulk-privacy_requests' );
+
+               $request_id = absint( current( array_keys( (array) wp_unslash( $_POST['export_personal_data_email_retry'] ) ) ) ); // WPCS: input var ok, sanitization ok.
+               $result     = _wp_privacy_resend_request( $request_id );
+
+               if ( is_wp_error( $result ) ) {
+                       add_settings_error(
+                               'export_personal_data_email_retry',
+                               'export_personal_data_email_retry',
+                               $result->get_error_message(),
+                               'error'
+                       );
+               } else {
+                       add_settings_error(
+                               'export_personal_data_email_retry',
+                               'export_personal_data_email_retry',
+                               __( 'Confirmation request re-resent successfully.' ),
+                               'updated'
+                       );
+               }
+
+       } elseif ( isset( $_POST['export_personal_data_email_send'] ) ) { // WPCS: input var ok.
+               check_admin_referer( 'bulk-privacy_requests' );
+
+               $request_id = absint( current( array_keys( (array) wp_unslash( $_POST['export_personal_data_email_send'] ) ) ) ); // WPCS: input var ok, sanitization ok.
+               $result     = false;
+
+               /**
+                * TODO: Email the data to the user here.
+                */
+
+               if ( is_wp_error( $result ) ) {
+                       add_settings_error(
+                               'export_personal_data_email_send',
+                               'export_personal_data_email_send',
+                               $result->get_error_message(),
+                               'error'
+                       );
+               } else {
+                       _wp_privacy_completed_request( $request_id );
+                       add_settings_error(
+                               'export_personal_data_email_send',
+                               'export_personal_data_email_send',
+                               __( 'Personal data was sent to the user successfully.' ),
+                               'updated'
+                       );
+               }
+
+       } elseif ( isset( $_POST['action'] ) ) {
+               $action = isset( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; // WPCS: input var ok, CSRF ok.
+
+               switch ( $action ) {
+                       case 'add_export_personal_data_request':
+                       case 'add_remove_personal_data_request':
+                               check_admin_referer( 'personal-data-request' );
+
+                               if ( ! isset( $_POST['type_of_action'], $_POST['username_or_email_to_export'] ) ) { // WPCS: input var ok.
+                                       add_settings_error(
+                                               'action_type',
+                                               'action_type',
+                                               __( 'Invalid action.' ),
+                                               'error'
+                                       );
+                               }
+                               $action_type               = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) ); // WPCS: input var ok.
+                               $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_to_export'] ) ); // WPCS: input var ok.
+                               $email_address             = '';
+
+                               if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) {
+                                       add_settings_error(
+                                               'action_type',
+                                               'action_type',
+                                               __( 'Invalid action.' ),
+                                               'error'
+                                       );
+                               }
+
+                               if ( ! is_email( $username_or_email_address ) ) {
+                                       $user = get_user_by( 'login', $username_or_email_address );
+                                       if ( ! $user instanceof WP_User ) {
+                                               add_settings_error(
+                                                       'username_or_email_to_export',
+                                                       'username_or_email_to_export',
+                                                       __( 'Unable to add export request. A valid email address or username must be supplied.' ),
+                                                       'error'
+                                               );
+                                       } else {
+                                               $email_address = $user->user_email;
+                                       }
+                               } else {
+                                       $email_address = $username_or_email_address;
+                               }
+
+                               if ( ! empty( $email_address ) ) {
+                                       $result = _wp_privacy_create_request( $email_address, $action_type, _wp_privacy_action_description( $action_type ) );
+
+                                       if ( is_wp_error( $result ) ) {
+                                               add_settings_error(
+                                                       'username_or_email_to_export',
+                                                       'username_or_email_to_export',
+                                                       $result->get_error_message(),
+                                                       'error'
+                                               );
+                                       } elseif ( ! $result ) {
+                                               add_settings_error(
+                                                       'username_or_email_to_export',
+                                                       'username_or_email_to_export',
+                                                       __( 'Unable to initiate confirmation request.' ),
+                                                       'error'
+                                               );
+                                       } else {
+                                               add_settings_error(
+                                                       'username_or_email_to_export',
+                                                       'username_or_email_to_export',
+                                                       __( 'Confirmation request initiated successfully.' ),
+                                                       'updated'
+                                               );
+                                       }
+                               }
+                               break;
+               }
+       }
+}
+
+/**
+ * Personal data export.
+ *
+ * @since 5.0.0
+ * @access private
+ */
+function _wp_personal_data_export_page() {
+       if ( ! current_user_can( 'manage_options' ) ) {
+               wp_die( esc_html__( 'Sorry, you are not allowed to manage privacy on this site.' ) );
+       }
+
+       _wp_personal_data_handle_actions();
+
+       $requests_table = new WP_Privacy_Data_Export_Requests_Table( array(
+               'plural'   => 'privacy_requests',
+               'singular' => 'privacy_request',
+       ) );
+       $requests_table->process_bulk_action();
+       $requests_table->prepare_items();
+       ?>
+       <div class="wrap nosubsub">
+               <h1><?php esc_html_e( 'Export Personal Data' ); ?></h1>
+               <hr class="wp-header-end" />
+
+               <?php settings_errors(); ?>
+
+               <form method="post" class="wp-privacy-request-form">
+                       <h2><?php esc_html_e( 'Add Data Export Request' ); ?></h2>
+                       <p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>
+
+                       <div class="wp-privacy-request-form-field">
+                               <label for="username_or_email_to_export"><?php esc_html_e( 'Username or email address' ); ?></label>
+                               <input type="text" required class="regular-text" id="username_or_email_to_export" name="username_or_email_to_export" />
+                               <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
+                       </div>
+                       <?php wp_nonce_field( 'personal-data-request' ); ?>
+                       <input type="hidden" name="action" value="add_export_personal_data_request" />
+                       <input type="hidden" name="type_of_action" value="user_export_request" />
+               </form>
+               <hr />
+
+               <?php $requests_table->views(); ?>
+
+               <form class="search-form wp-clearfix">
+                       <?php $requests_table->search_box( __( 'Search Requests' ), 'requests' ); ?>
+                       <input type="hidden" name="page" value="export_personal_data" />
+                       <input type="hidden" name="filter-status" value="<?php echo isset( $_REQUEST['filter-status'] ) ? esc_attr( sanitize_text_field( $_REQUEST['filter-status'] ) ) : ''; ?>" />
+                       <input type="hidden" name="orderby" value="<?php echo isset( $_REQUEST['orderby'] ) ? esc_attr( sanitize_text_field( $_REQUEST['orderby'] ) ) : ''; ?>" />
+                       <input type="hidden" name="order" value="<?php echo isset( $_REQUEST['order'] ) ? esc_attr( sanitize_text_field( $_REQUEST['order'] ) ) : ''; ?>" />
+               </form>
+
+               <form method="post">
+                       <?php
+                       $requests_table->display();
+                       $requests_table->embed_scripts();
+                       ?>
+               </form>
+       </div>
+       <?php
+}
+
+/**
+ * Personal data anonymization.
+ *
+ * @since 5.0.0
+ * @access private
+ */
+function _wp_personal_data_removal_page() {
+       if ( ! current_user_can( 'manage_options' ) ) {
+               wp_die( esc_html__( 'Sorry, you are not allowed to manage privacy on this site.' ) );
+       }
+
+       _wp_personal_data_handle_actions();
+
+       $requests_table = new WP_Privacy_Data_Removal_Requests_Table( array(
+               'plural'   => 'privacy_requests',
+               'singular' => 'privacy_request',
+       ) );
+       $requests_table->process_bulk_action();
+       $requests_table->prepare_items();
+       ?>
+       <div class="wrap nosubsub">
+               <h1><?php esc_html_e( 'Remove Personal Data' ); ?></h1>
+               <hr class="wp-header-end" />
+
+               <?php settings_errors(); ?>
+
+               <form method="post" class="wp-privacy-request-form">
+                       <h2><?php esc_html_e( 'Add Data Removal Request' ); ?></h2>
+                       <p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>
+
+                       <div class="wp-privacy-request-form-field">
+                               <label for="username_or_email_to_export"><?php esc_html_e( 'Username or email address' ); ?></label>
+                               <input type="text" required class="regular-text" id="username_or_email_to_export" name="username_or_email_to_export" />
+                               <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
+                       </div>
+                       <?php wp_nonce_field( 'personal-data-request' ); ?>
+                       <input type="hidden" name="action" value="add_remove_personal_data_request" />
+                       <input type="hidden" name="type_of_action" value="user_remove_request" />
+               </form>
+               <hr />
+
+               <?php $requests_table->views(); ?>
+
+               <form class="search-form wp-clearfix">
+                       <?php $requests_table->search_box( __( 'Search Requests' ), 'requests' ); ?>
+                       <input type="hidden" name="page" value="export_personal_data" />
+                       <input type="hidden" name="filter-status" value="<?php echo isset( $_REQUEST['filter-status'] ) ? esc_attr( sanitize_text_field( $_REQUEST['filter-status'] ) ) : ''; ?>" />
+                       <input type="hidden" name="orderby" value="<?php echo isset( $_REQUEST['orderby'] ) ? esc_attr( sanitize_text_field( $_REQUEST['orderby'] ) ) : ''; ?>" />
+                       <input type="hidden" name="order" value="<?php echo isset( $_REQUEST['order'] ) ? esc_attr( sanitize_text_field( $_REQUEST['order'] ) ) : ''; ?>" />
+               </form>
+
+               <form method="post">
+                       <?php
+                       $requests_table->display();
+                       $requests_table->embed_scripts();
+                       ?>
+               </form>
+       </div>
+       <?php
+}
+
+/**
+ * Add requests pages.
+ *
+ * @since 5.0.0
+ * @access private
+ */
+function _wp_privacy_hook_requests_page() {
+       add_submenu_page( 'tools.php', __( 'Export Personal Data' ), __( 'Export Personal Data' ), 'manage_options', 'export_personal_data', '_wp_personal_data_export_page' );
+       add_submenu_page( 'tools.php', __( 'Remove Personal Data' ), __( 'Remove Personal Data' ), 'manage_options', 'remove_personal_data', '_wp_personal_data_removal_page' );
+}
+
+// TODO: move the following classes in new files.
+if ( ! class_exists( 'WP_List_Table' ) ) {
+       require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
+}
+
+/**
+ * WP_Privacy_Requests_Table class.
+ */
+abstract class WP_Privacy_Requests_Table extends WP_List_Table {
+
+       /**
+        * Action name for the requests this table will work with. Classes
+        * which inherit from WP_Privacy_Requests_Table should define this.
+        * e.g. 'user_export_request'
+        *
+        * @since 5.0.0
+        *
+        * @var string $request_type Name of action.
+        */
+       protected $request_type = 'INVALID';
+
+       /**
+        * Get columns to show in the list table.
+        *
+        * @since 5.0.0
+        *
+        * @param array Array of columns.
+        */
+       public function get_columns() {
+               $columns = array(
+                       'cb'         => '<input type="checkbox" />',
+                       'email'      => __( 'Requester' ),
+                       'status'     => __( 'Status' ),
+                       'requested'  => __( 'Requested' ),
+                       'next_steps' => __( 'Next Steps' ),
+               );
+               return $columns;
+       }
+
+       /**
+        * Get a list of sortable columns.
+        *
+        * @since 5.0.0
+        *
+        * @return array
+        */
+       protected function get_sortable_columns() {
+               return array();
+       }
+
+       /**
+        * Default primary column.
+        *
+        * @since 5.0.0
+        *
+        * @return string
+        */
+       protected function get_default_primary_column_name() {
+               return 'email';
+       }
+
+       /**
+        * Get an associative array ( id => link ) with the list
+        * of views available on this table.
+        *
+        * @since 5.0.0
+        *
+        * @return array
+        */
+       protected function get_views() {
+               $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ): '';
+               $statuses       = _wp_privacy_statuses();
+               $views          = array();
+               $admin_url      = admin_url( 'tools.php?page=' . $this->request_type );
+               $counts         = wp_count_posts( $this->request_type );
+
+               $current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : '';
+               $views['all']            = '<a href="' . esc_url( $admin_url ) . "\" $current_link_attributes>" . esc_html__( 'All' ) . ' (' . absint( array_sum( (array) $counts ) ) . ')</a>';
+
+               foreach ( $statuses as $status => $label ) {
+                       $current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : '';
+                       $views[ $status ]        = '<a href="' . esc_url( add_query_arg( 'filter-status', $status, $admin_url ) ) . "\" $current_link_attributes>" . esc_html( $label ) . ' (' . absint( $counts->$status ) . ')</a>';
+               }
+
+               return $views;
+       }
+
+       /**
+        * Get bulk actions.
+        *
+        * @since 5.0.0
+        *
+        * @return array
+        */
+       protected function get_bulk_actions() {
+               return array(
+                       'delete' => __( 'Remove' ),
+                       'resend' => __( 'Resend email' ),
+               );
+       }
+
+       /**
+        * Process bulk actions.
+        *
+        * @since 5.0.0
+        */
+       public function process_bulk_action() {
+               $action      = $this->current_action();
+               $request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array(); // WPCS: input var ok, CSRF ok.
+
+               if ( $request_ids ) {
+                       check_admin_referer( 'bulk-privacy_requests' );
+               }
+
+               switch ( $action ) {
+                       case 'delete':
+                               $count = 0;
+
+                               foreach ( $request_ids as $request_id ) {
+                                       if ( wp_delete_post( $request_id, true ) ) {
+                                               $count ++;
+                                       }
+                               }
+
+                               add_settings_error(
+                                       'bulk_action',
+                                       'bulk_action',
+                                       sprintf( _n( 'Deleted %d request', 'Deleted %d requests', $count ), $count ),
+                                       'updated'
+                               );
+                               break;
+                       case 'resend':
+                               $count = 0;
+
+                               foreach ( $request_ids as $request_id ) {
+                                       if ( _wp_privacy_resend_request( $request_id ) ) {
+                                               $count ++;
+                                       }
+                               }
+
+                               add_settings_error(
+                                       'bulk_action',
+                                       'bulk_action',
+                                       sprintf( _n( 'Re-sent %d request', 'Re-sent %d requests', $count ), $count ),
+                                       'updated'
+                               );
+                               break;
+               }
+       }
+
+       /**
+        * Prepare items to output.
+        *
+        * @since 5.0.0
+        */
+       public function prepare_items() {
+               global $wpdb;
+
+               $primary               = $this->get_primary_column_name();
+               $this->_column_headers = array(
+                       $this->get_columns(),
+                       array(),
+                       $this->get_sortable_columns(),
+                       $primary,
+               );
+
+               $this->items    = array();
+               $posts_per_page = 20;
+               $args           = array(
+                       'post_type'      => $this->request_type,
+                       'posts_per_page' => $posts_per_page,
+                       'offset'         => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page: 0,
+                       'post_status'    => 'any',
+               );
+
+               if ( ! empty( $_REQUEST['filter-status'] ) ) {
+                       $filter_status       = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
+                       $args['post_status'] = $filter_status;
+               }
+
+               if ( ! empty( $_REQUEST['s'] ) ) {
+                       $args['meta_query'] = array(
+                               $name_query,
+                               'relation'  => 'AND',
+                               array(
+                                       'key'     => '_user_email',
+                                       'value'   => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ): '',
+                                       'compare' => 'LIKE'
+                               ),
+                       );
+               }
+
+               $privacy_requests_query = new WP_Query( $args );
+               $privacy_requests       = $privacy_requests_query->posts;
+
+               foreach ( $privacy_requests as $privacy_request ) {
+                       $this->items[] = array(
+                               'request_id' => $privacy_request->ID,
+                               'user_id'    => $privacy_request->post_author,
+                               'email'      => get_post_meta( $privacy_request->ID, '_user_email', true ),
+                               'action'     => get_post_meta( $privacy_request->ID, '_action_name', true ),
+                               'requested'  => strtotime( $privacy_request->post_date_gmt ),
+                               'confirmed'  => get_post_meta( $privacy_request->ID, '_confirmed_timestamp', true ),
+                               'completed'  => get_post_meta( $privacy_request->ID, '_completed_timestamp', true ),
+                       );
+               }
+
+               $this->set_pagination_args(
+                       array(
+                               'total_items' => $privacy_requests_query->found_posts,
+                               'per_page'    => $posts_per_page,
+                       )
+               );
+       }
+
+       /**
+        * Checkbox column.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item Item being shown.
+        * @return string
+        */
+       public function column_cb( $item ) {
+               return sprintf( '<input type="checkbox" name="request_id[]" value="%1$s" /><span class="spinner"></span>', esc_attr( $item['request_id'] ) );
+       }
+
+       /**
+        * Status column.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item Item being shown.
+        * @return string
+        */
+       public function column_status( $item ) {
+               $status        = get_post_status( $item['request_id'] );
+               $status_object = get_post_status_object( $status );
+
+               if ( ! $status_object || empty( $status_object->label ) ) {
+                       return '-';
+               }
+
+               $timestamp = false;
+
+               switch ( $status ) {
+                       case 'request-confirmed':
+                               $timestamp = $item['confirmed'];
+                               break;
+                       case 'request-completed':
+                               $timestamp = $item['completed'];
+                               break;
+               }
+
+               echo '<span class="status-label status-' . esc_attr( $status ) . '">';
+               echo esc_html( $status_object->label );
+
+               if ( $timestamp ) {
+                       echo ' (' . $this->get_timestamp_as_date( $timestamp ) . ')';
+               }
+
+               echo '</span>';
+       }
+
+       /**
+        * Convert timestamp for display.
+        *
+        * @since 5.0.0
+        *
+        * @param int $timestamp Event timestamp.
+        * @return string
+        */
+       protected function get_timestamp_as_date( $timestamp ) {
+               if ( empty( $timestamp ) ) {
+                       return '';
+               }
+
+               $time_diff = current_time( 'timestamp', true ) - $timestamp;
+
+               if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) {
+                       return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
+               }
+
+               return date_i18n( get_option( 'date_format' ), $timestamp );
+       }
+
+       /**
+        * Default column handler.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item         Item being shown.
+        * @param string $column_name Name of column being shown.
+        * @return string
+        */
+       public function column_default( $item, $column_name ) {
+               $cell_value = $item[ $column_name ];
+
+               if ( in_array( $column_name, array( 'requested' ), true ) ) {
+                       return $this->get_timestamp_as_date( $cell_value );
+               }
+
+               return $cell_value;
+       }
+
+       /**
+        * Actions column. Overriden by children.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item Item being shown.
+        * @return string
+        */
+       public function column_email( $item ) {
+               return sprintf( '%1$s %2$s', $item['email'], $this->row_actions( array() ) );
+       }
+
+       /**
+        * Next steps column. Overriden by children.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item Item being shown.
+        */
+       public function column_next_steps( $item ) {}
+
+       /**
+        * Generates content for a single row of the table
+        *
+        * @since 5.0.0
+        *
+        * @param object $item The current item
+        */
+       public function single_row( $item ) {
+               $status = get_post_status( $item['request_id'] );
+
+               echo '<tr class="status-' . esc_attr( $status ) . '">';
+               $this->single_row_columns( $item );
+               echo '</tr>';
+       }
+
+       /**
+        * Embed scripts used to perform actions. Overriden by children.
+        *
+        * @since 5.0.0
+        */
+       public function embed_scripts() {}
+}
+
+/**
+ * WP_Privacy_Data_Export_Requests_Table class.
+ *
+ * @since 5.0.0
+ */
+class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Requests_Table {
+       /**
+        * Action name for the requests this table will work with. Classes
+        * which inherit from WP_Privacy_Requests_Table should define this.
+        * e.g. 'user_export_request'
+        *
+        * @since 5.0.0
+        *
+        * @var string $request_type Name of action.
+        */
+       protected $request_type = 'user_export_request';
+
+       /**
+        * Actions column.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item Item being shown.
+        * @return string
+        */
+       public function column_email( $item ) {
+               $row_actions = array(
+                       'download_data' => __( 'Download Personal Data' ),
+               );
+
+               return sprintf( '%1$s %2$s', $item['email'], $this->row_actions( $row_actions ) );
+       }
+
+       /**
+        * Next steps column.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item Item being shown.
+        */
+       public function column_next_steps( $item ) {
+               $status = get_post_status( $item['request_id'] );
+
+               switch ( $status ) {
+                       case 'request-pending':
+                               esc_html_e( 'Waiting for confirmation' );
+                               break;
+                       case 'request-confirmed':
+                               // TODO Complete in follow on patch.
+                               break;
+                       case 'request-failed':
+                               submit_button( __( 'Retry' ), 'secondary', 'export_personal_data_email_retry[' . $item['request_id'] . ']', false );
+                               break;
+                       case 'request-completed':
+                               echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
+                                       'action' => 'delete',
+                                       'request_id' => array( $item['request_id'] )
+                               ), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>';
+                               break;
+               }
+       }
+}
+
+/**
+ * WP_Privacy_Data_Removal_Requests_Table class.
+ *
+        * @since 5.0.0
+ */
+class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Requests_Table {
+       /**
+        * Action name for the requests this table will work with. Classes
+        * which inherit from WP_Privacy_Requests_Table should define this.
+        * e.g. 'user_remove_request'
+        *
+        * @since 5.0.0
+        *
+        * @var string $request_type Name of action.
+        */
+       protected $request_type = 'user_remove_request';
+
+       /**
+        * Actions column.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item Item being shown.
+        * @return string
+        */
+       public function column_email( $item ) {
+               $row_actions = array(
+                       // TODO Complete in follow on patch.
+                       'remove_data' => __( 'Remove Personal Data' ),
+               );
+
+               // If we have a user ID, include a delete user action.
+               if ( ! empty( $item['user_id'] ) ) {
+                       // TODO Complete in follow on patch.
+                       $row_actions['delete_user'] = __( 'Delete User' );
+               }
+
+               return sprintf( '%1$s %2$s', $item['email'], $this->row_actions( $row_actions ) );
+       }
+
+       /**
+        * Next steps column.
+        *
+        * @since 5.0.0
+        *
+        * @param array $item Item being shown.
+        */
+       public function column_next_steps( $item ) {
+       }
+
+}
</ins></span></pre></div>
<a id="trunksrcwpincludespostphp"></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/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/post.php    2018-04-10 16:11:55 UTC (rev 42966)
+++ trunk/src/wp-includes/post.php      2018-04-10 18:01:20 UTC (rev 42967)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -226,6 +226,38 @@
</span><span class="cx" style="display: block; padding: 0 10px">                )
</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">+        register_post_type(
+               'user_export_request', array(
+                       'labels'           => array(
+                               'name'          => __( 'Export Personal Data Requests' ),
+                               'singular_name' => __( 'Export Personal Data Request' ),
+                       ),
+                       'public'           => false,
+                       '_builtin'         => true, /* internal use only. don't use this when registering your own post type. */
+                       'hierarchical'     => false,
+                       'rewrite'          => false,
+                       'query_var'        => false,
+                       'can_export'       => false,
+                       'delete_with_user' => false,
+               )
+       );
+
+       register_post_type(
+               'user_remove_request', array(
+                       'labels'           => array(
+                               'name'          => __( 'Remove Personal Data Requests' ),
+                               'singular_name' => __( 'Remove Personal Data Request' ),
+                       ),
+                       'public'           => false,
+                       '_builtin'         => true, /* internal use only. don't use this when registering your own post type. */
+                       'hierarchical'     => false,
+                       'rewrite'          => false,
+                       'query_var'        => false,
+                       'can_export'       => false,
+                       'delete_with_user' => false,
+               )
+       );
+
</ins><span class="cx" style="display: block; padding: 0 10px">         register_post_status(
</span><span class="cx" style="display: block; padding: 0 10px">                'publish', array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'label'       => _x( 'Published', 'post status' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -297,6 +329,42 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'exclude_from_search' => false,
</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">+
+       register_post_status(
+               'request-pending', array(
+                       'label'               => _x( 'Pending', 'request status' ),
+                       'internal'            => true,
+                       '_builtin'            => true, /* internal use only. */
+                       'exclude_from_search' => false,
+               )
+       );
+
+       register_post_status(
+               'request-confirmed', array(
+                       'label'               => _x( 'Confirmed', 'request status' ),
+                       'internal'            => true,
+                       '_builtin'            => true, /* internal use only. */
+                       'exclude_from_search' => false,
+               )
+       );
+
+       register_post_status(
+               'request-failed', array(
+                       'label'               => _x( 'Failed', 'request status' ),
+                       'internal'            => true,
+                       '_builtin'            => true, /* internal use only. */
+                       'exclude_from_search' => false,
+               )
+       );
+
+       register_post_status(
+               'request-completed', array(
+                       'label'               => _x( 'Completed', 'request status' ),
+                       'internal'            => true,
+                       '_builtin'            => true, /* internal use only. */
+                       'exclude_from_search' => false,
+               )
+       );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -783,6 +851,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</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">+ * Return statuses for privacy requests.
+ *
+ * @since 5.0.0
+ *
+ * @return array
+ */
+function _wp_privacy_statuses() {
+       return array(
+               'request-pending'   => __( 'Pending' ),      // Pending confirmation from user.
+               'request-confirmed' => __( 'Confirmed' ),    // User has confirmed the action.
+               'request-failed'    => __( 'Failed' ),       // User failed to confirm the action.
+               'request-completed' => __( 'Completed' ),    // Admin has handled the request.
+       );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Register a post status. Do not use before init.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * A simple function for creating or modifying a post status based on the
</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    2018-04-10 16:11:55 UTC (rev 42966)
+++ trunk/src/wp-includes/user.php      2018-04-10 18:01:20 UTC (rev 42967)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2811,11 +2811,78 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</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">+ * Get all user privacy request types.
+ *
+ * @since 5.0.0
+ * @access private
+ *
+ * @return array
+ */
+function _wp_privacy_action_request_types() {
+       return array(
+               'user_export_request',
+               'user_remove_request',
+       );
+}
+
+/**
+ * Update log when privacy request is confirmed.
+ *
+ * @since 5.0.0
+ * @access private
+ *
+ * @param array $result Result of the request from the user.
+ */
+function _wp_privacy_account_request_confirmed( $result ) {
+       if ( isset( $result['action'], $result['request_data'], $result['request_data']['privacy_request_id'] ) && in_array( $result['action'], _wp_privacy_action_request_types(), true ) ) {
+               $privacy_request_id = absint( $result['request_data']['privacy_request_id'] );
+               $privacy_request    = get_post( $privacy_request_id );
+
+               if ( ! $privacy_request || ! in_array( $privacy_request->post_type, _wp_privacy_action_request_types(), true ) ) {
+                       return;
+               }
+
+               update_post_meta( $privacy_request_id, '_confirmed_timestamp', time() );
+               wp_update_post( array(
+                       'ID'          => $privacy_request_id,
+                       'post_status' => 'request-confirmed',
+               ) );
+       }
+}
+add_action( 'account_action_confirmed', '_wp_privacy_account_request_confirmed' );
+
+/**
+ * Update log when privacy request fails.
+ *
+ * @since 5.0.0
+ * @access private
+ *
+ * @param array $result Result of the request from the user.
+ */
+function _wp_privacy_account_request_failed( $result ) {
+       if ( isset( $result['action'], $result['request_data'], $result['request_data']['privacy_request_id'] ) &&
+               in_array( $result['action'], _wp_privacy_action_request_types(), true ) ) {
+
+               $privacy_request_id = absint( $result['request_data']['privacy_request_id'] );
+               $privacy_request    = get_post( $privacy_request_id );
+
+               if ( ! $privacy_request || ! in_array( $privacy_request->post_type, _wp_privacy_action_request_types(), true ) ) {
+                       return;
+               }
+
+               wp_update_post( array(
+                       'ID'          => $privacy_request_id,
+                       'post_status' => 'request-failed',
+               ) );
+       }
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Send a confirmation request email to confirm an action.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 5.0.0
</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              User email address. This can be the address of a registered or non-registered user. Defaults to logged in user email address. 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $email              User email address. This can be the address of a registered or non-registered user. Defaults to logged in user email address.
</ins><span class="cx" style="display: block; padding: 0 10px">  * @param string $action_name        Name of the action that is being confirmed. Defaults to 'confirm_email'.
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string $action_description User facing description of the action they will be confirming. Defaults to "confirm your email address".
</span><span class="cx" style="display: block; padding: 0 10px">  * @param array  $request_data       Misc data you want to send with the verification request and pass to the actions once the request is confirmed.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2917,7 +2984,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * ###SITEURL###            The URL to the site.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.0.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  *
</ins><span class="cx" style="display: block; padding: 0 10px">          * @param string $email_text     Text in the email.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param array  $email_data {
</span><span class="cx" style="display: block; padding: 0 10px">         *     Data relating to the account action email.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3039,14 +3106,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $raw_data = get_user_meta( $user->ID, '_verify_action_' . $action_name, true );
</span><span class="cx" style="display: block; padding: 0 10px">                $email    = $user->user_email;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( false !== strpos( $confirm_action_data, ':' ) ) {
-                       list( $key_request_time, $saved_key ) = explode( ':', $confirm_action_data, 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( false !== strpos( $raw_data, ':' ) ) {
+                       list( $key_request_time, $saved_key ) = explode( ':', $raw_data, 2 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                $raw_data = get_site_option( '_verify_action_' . $action_name . '_' . $uid, '' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( false !== strpos( $confirm_action_data, ':' ) ) {
-                       list( $key_request_time, $saved_key, $email ) = explode( ':', $confirm_action_data, 3 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( false !== strpos( $raw_data, ':' ) ) {
+                       list( $key_request_time, $saved_key, $email ) = explode( ':', $raw_data, 3 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3068,7 +3135,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * Filters the expiration time of confirm keys.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.0.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  *
</ins><span class="cx" style="display: block; padding: 0 10px">          * @param int $expiration The expiration time in seconds.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        $expiration_duration = apply_filters( 'account_verification_expiration', DAY_IN_SECONDS );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3096,4 +3163,4 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        return $return;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
</ins></span></pre>
</div>
</div>

</body>
</html>