<!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>[43084] branches/4.9/src: Privacy: update and enhance the method to confirm user requests by email.</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/43084">43084</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/43084","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-05-02 01:03:53 +0000 (Wed, 02 May 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: update and enhance the method to confirm user requests by email. Introduce WP_User_Request to hold all request vars similarly to WP_Post.

Props mikejolley, desrosj.
Merges <a href="https://core.trac.wordpress.org/changeset/43011">[43011]</a> and <a href="https://core.trac.wordpress.org/changeset/43014">[43014]</a> to the 4.9 branch.
See <a href="https://core.trac.wordpress.org/ticket/43443">#43443</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches49srcwpadminincludesajaxactionsphp">branches/4.9/src/wp-admin/includes/ajax-actions.php</a></li>
<li><a href="#branches49srcwpadminincludesuserphp">branches/4.9/src/wp-admin/includes/user.php</a></li>
<li><a href="#branches49srcwpincludespostphp">branches/4.9/src/wp-includes/post.php</a></li>
<li><a href="#branches49srcwpincludesuserphp">branches/4.9/src/wp-includes/user.php</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#branches49">branches/4.9/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/4.9
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/4.9 2018-05-02 01:00:46 UTC (rev 43083)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/4.9  2018-05-02 01:03:53 UTC (rev 43084)
</ins><a id="branches49"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/4.9</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.1:18031
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.3:20543
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:18512,42132,42134,42136,42138,42140,42144,42146,42148,42150,42152-42153,42155,42157,42159,42161,42163,42169,42171,42173,42175,42177,42181,42183,42185,42187,42189,42191,42193,42199,42203,42210,42214,42220,42222,42226,42242,42244,42247,42251,42256-42261,42350,42358,42362,42364-42368,42374,42388,42390,42401,42417,42421,42423-42425,42430,42433,42437,42441,42443,42446-42447,42449,42451,42453,42457,42459,42462,42491,42521,42529,42531,42533,42536,42538,42541,42543,42545,42549,42566,42568,42570,42572,42574,42576,42579,42581-42582,42584-42585,42587-42588,42590,42592,42594-42595,42598-42599,42602,42604,42606,42611-42613,42615,42617,42624-42625,42639,42648,42652-42653,42665,42687,42711,42713,42719,42722,42739-42740,42744,42758,42791-42792,42801,42817-42818,42830,42837,42839,42841,42844,42851-42852,42860,42864,42881,42888-42889,42892-42894,42930,42964,42967,42971-42972,42977,42986-42987,42989
 ,42994,42998,43001,43004,43007-43008,43025,43027,43030,43032,43034,43036,43039,43056,43058,43062-43063,43065,43081
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:18512,42132,42134,42136,42138,42140,42144,42146,42148,42150,42152-42153,42155,42157,42159,42161,42163,42169,42171,42173,42175,42177,42181,42183,42185,42187,42189,42191,42193,42199,42203,42210,42214,42220,42222,42226,42242,42244,42247,42251,42256-42261,42350,42358,42362,42364-42368,42374,42388,42390,42401,42417,42421,42423-42425,42430,42433,42437,42441,42443,42446-42447,42449,42451,42453,42457,42459,42462,42491,42521,42529,42531,42533,42536,42538,42541,42543,42545,42549,42566,42568,42570,42572,42574,42576,42579,42581-42582,42584-42585,42587-42588,42590,42592,42594-42595,42598-42599,42602,42604,42606,42611-42613,42615,42617,42624-42625,42639,42648,42652-42653,42665,42687,42711,42713,42719,42722,42739-42740,42744,42758,42791-42792,42801,42817-42818,42830,42837,42839,42841,42844,42851-42852,42860,42864,42881,42888-42889,42892-42894,42930,42964,42967,42971-42972,42977,42986-42987,42989
 ,42994,42998,43001,43004,43007-43008,43011,43014,43025,43027,43030,43032,43034,43036,43039,43056,43058,43062-43063,43065,43081
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches49srcwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.9/src/wp-admin/includes/ajax-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-admin/includes/ajax-actions.php       2018-05-02 01:00:46 UTC (rev 43083)
+++ branches/4.9/src/wp-admin/includes/ajax-actions.php 2018-05-02 01:03:53 UTC (rev 43084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4154,12 +4154,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">        check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Find the request CPT
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $request = get_post( $request_id );
-       if ( 'remove_personal_data' !== $request->post_title ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $request = wp_get_user_request_data( $request_id );
+
+       if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 wp_send_json_error( __( 'Error: Invalid request ID.' ) );
</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">-        $email_address = get_post_meta( $request_id, '_wp_user_request_user_email', true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $email_address = $request->email;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! is_email( $email_address ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                wp_send_json_error( __( 'Error: Invalid email address in request.' ) );
</span></span></pre></div>
<a id="branches49srcwpadminincludesuserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.9/src/wp-admin/includes/user.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-admin/includes/user.php       2018-05-02 01:00:46 UTC (rev 43083)
+++ branches/4.9/src/wp-admin/includes/user.php 2018-05-02 01:03:53 UTC (rev 43084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -585,10 +585,12 @@
</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">        update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         $request = wp_update_post( array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'ID'          => $request_data['request_id'],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'ID'          => $request_id,
</ins><span class="cx" style="display: block; padding: 0 10px">                 'post_status' => 'request-confirmed',
</span><span class="cx" style="display: block; padding: 0 10px">        ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         return $request;
</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">@@ -731,6 +733,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">+ * Cleans up failed and expired requests before displaying the list table.
+ *
+ * @since 4.9.6
+ * @access private
+ */
+function _wp_personal_data_cleanup_requests() {
+       $expires        = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS );
+       $requests_query = new WP_Query( array(
+               'post_type'      => 'user_request',
+               'posts_per_page' => -1,
+               'post_status'    => 'request-pending',
+               'fields'         => 'ids',
+               'date_query' => array(
+                       array(
+                               'column' => 'post_modified_gmt',
+                               'before' => $expires . ' seconds ago',
+                       ),
+               ),
+       ) );
+
+       $request_ids = $requests_query->posts;
+
+       foreach ( $request_ids as $request_id ) {
+               wp_update_post( array(
+                       'ID'            => $request_id,
+                       'post_status'   => 'request-failed',
+                       'post_password' => '',
+               ) );
+       }
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Personal data export.
</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="lines" style="display: block; padding: 0 10px; color: #888">@@ -742,6 +776,7 @@
</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">        _wp_personal_data_handle_actions();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        _wp_personal_data_cleanup_requests();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $requests_table = new WP_Privacy_Data_Export_Requests_Table( array(
</span><span class="cx" style="display: block; padding: 0 10px">                'plural'   => 'privacy_requests',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -803,6 +838,7 @@
</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">        _wp_personal_data_handle_actions();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        _wp_personal_data_cleanup_requests();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // "Borrow" xfn.js for now so we don't have to create new files.
</span><span class="cx" style="display: block; padding: 0 10px">        wp_enqueue_script( 'xfn' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -841,7 +877,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                <form class="search-form wp-clearfix">
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php $requests_table->search_box( __( 'Search Requests' ), 'requests' ); ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <input type="hidden" name="page" value="export_personal_data" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <input type="hidden" name="page" value="remove_personal_data" />
</ins><span class="cx" style="display: block; padding: 0 10px">                         <input type="hidden" name="filter-status" value="<?php echo isset( $_REQUEST['filter-status'] ) ? esc_attr( sanitize_text_field( $_REQUEST['filter-status'] ) ) : ''; ?>" />
</span><span class="cx" style="display: block; padding: 0 10px">                        <input type="hidden" name="orderby" value="<?php echo isset( $_REQUEST['orderby'] ) ? esc_attr( sanitize_text_field( $_REQUEST['orderby'] ) ) : ''; ?>" />
</span><span class="cx" style="display: block; padding: 0 10px">                        <input type="hidden" name="order" value="<?php echo isset( $_REQUEST['order'] ) ? esc_attr( sanitize_text_field( $_REQUEST['order'] ) ) : ''; ?>" />
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -907,11 +943,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function get_columns() {
</span><span class="cx" style="display: block; padding: 0 10px">                $columns = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'cb'                  => '<input type="checkbox" />',
-                       'email'               => __( 'Requester' ),
-                       'status'              => __( 'Status' ),
-                       'requested_timestamp' => __( 'Requested' ),
-                       'next_steps'          => __( 'Next Steps' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'cb'                => '<input type="checkbox" />',
+                       'email'             => __( 'Requester' ),
+                       'status'            => __( 'Status' ),
+                       'created_timestamp' => __( 'Requested' ),
+                       'next_steps'        => __( 'Next Steps' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px">                return $columns;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -959,7 +995,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        SELECT post_status, COUNT( * ) AS num_posts 
</span><span class="cx" style="display: block; padding: 0 10px">                        FROM {$wpdb->posts} 
</span><span class="cx" style="display: block; padding: 0 10px">                        WHERE post_type = %s
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        AND post_title = %s
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 AND post_name = %s
</ins><span class="cx" style="display: block; padding: 0 10px">                         GROUP BY post_status";
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $this->post_type, $this->request_type ), ARRAY_A );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1047,7 +1083,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'resend':
</span><span class="cx" style="display: block; padding: 0 10px">                                foreach ( $request_ids as $request_id ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        $resend = _wp_privacy_resend_request( $request_id );
</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">                                         if ( $resend && ! is_wp_error( $resend ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                $count++;
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1083,10 +1119,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $posts_per_page = 20;
</span><span class="cx" style="display: block; padding: 0 10px">                $args           = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_type'      => $this->post_type,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'title'          => $this->request_type,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'post_name__in'  => array( $this->request_type ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'posts_per_page' => $posts_per_page,
</span><span class="cx" style="display: block; padding: 0 10px">                        'offset'         => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page: 0,
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_status'    => 'any',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        's'              => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '',
</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">                if ( ! empty( $_REQUEST['filter-status'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1094,18 +1131,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $args['post_status'] = $filter_status;
</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">-                if ( ! empty( $_REQUEST['s'] ) ) {
-                       $args['meta_query'] = array(
-                               $name_query,
-                               'relation'  => 'AND',
-                               array(
-                                       'key'     => '_wp_user_request_user_email',
-                                       'value'   => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ): '',
-                                       'compare' => 'LIKE',
-                               ),
-                       );
-               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $requests_query = new WP_Query( $args );
</span><span class="cx" style="display: block; padding: 0 10px">                $requests       = $requests_query->posts;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1113,6 +1138,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->items[] = wp_get_user_request_data( $request->ID );
</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">+                $this->items = array_filter( $this->items );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->set_pagination_args(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'total_items' => $requests_query->found_posts,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1126,11 +1153,11 @@
</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 array $item Item being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item Item being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_cb( $item ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return sprintf( '<input type="checkbox" name="request_id[]" value="%1$s" /><span class="spinner"></span>', esc_attr( $item['request_id'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return sprintf( '<input type="checkbox" name="request_id[]" value="%1$s" /><span class="spinner"></span>', esc_attr( $item->ID ) );
</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">@@ -1138,11 +1165,11 @@
</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 array $item Item being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item Item being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_status( $item ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $status        = get_post_status( $item['request_id'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $status        = get_post_status( $item->ID );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $status_object = get_post_status_object( $status );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! $status_object || empty( $status_object->label ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1153,10 +1180,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                switch ( $status ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-confirmed':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $timestamp = $item['confirmed_timestamp'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $timestamp = $item->confirmed_timestamp;
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-completed':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $timestamp = $item['completed_timestamp'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $timestamp = $item->completed_timestamp;
</ins><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><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1197,14 +1224,14 @@
</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 array $item         Item being shown.
-        * @param string $column_name Name of column being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item         Item being shown.
+        * @param string          $column_name Name of column being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_default( $item, $column_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $cell_value = $item[ $column_name ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $cell_value = $item->$column_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( in_array( $column_name, array( 'requested_timestamp' ), true ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( in_array( $column_name, array( 'created_timestamp' ), true ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return $this->get_timestamp_as_date( $cell_value );
</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">@@ -1216,11 +1243,11 @@
</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 array $item Item being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item Item being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_email( $item ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return sprintf( '%1$s %2$s', $item['email'], $this->row_actions( array() ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return sprintf( '%1$s %2$s', $item->email, $this->row_actions( array() ) );
</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">@@ -1228,7 +1255,7 @@
</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 array $item Item being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item Item being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_next_steps( $item ) {}
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1237,10 +1264,10 @@
</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 object $item The current item
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item The current item
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function single_row( $item ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $status = get_post_status( $item['request_id'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $status = $item->status;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                echo '<tr class="status-' . esc_attr( $status ) . '">';
</span><span class="cx" style="display: block; padding: 0 10px">                $this->single_row_columns( $item );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1284,13 +1311,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 array $item Item being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item Item being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_email( $item ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $exporters       = apply_filters( 'wp_privacy_personal_data_exporters', array() );
</span><span class="cx" style="display: block; padding: 0 10px">                $exporters_count = count( $exporters );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $request_id      = $item['request_id'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $request_id      = $item->ID;
</ins><span class="cx" style="display: block; padding: 0 10px">                 $nonce           = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $download_data_markup = '<div class="download_personal_data" ' .
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1307,7 +1334,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'download_data' => $download_data_markup,
</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">-                return sprintf( '%1$s %2$s', $item['email'], $this->row_actions( $row_actions ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return sprintf( '%1$s %2$s', $item->email, $this->row_actions( $row_actions ) );
</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">@@ -1315,10 +1342,10 @@
</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 array $item Item being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item Item being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_next_steps( $item ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $status = get_post_status( $item['request_id'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $status = $item->status;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                switch ( $status ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-pending':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1328,12 +1355,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                // TODO Complete in follow on patch.
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-failed':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item['request_id'] . ']', false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-completed':
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'action' => 'delete',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'request_id' => array( $item['request_id'] )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'request_id' => array( $item->ID )
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>';
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1369,18 +1396,18 @@
</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 array $item Item being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item Item being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_email( $item ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $row_actions = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Allow the administrator to "force remove" the personal data even if confirmation has not yet been received
-               $status = get_post_status( $item['request_id'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Allow the administrator to "force remove" the personal data even if confirmation has not yet been received.
+               $status = $item->status;
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( 'request-confirmed' !== $status ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $erasers       = apply_filters( 'wp_privacy_personal_data_erasers', array() );
</span><span class="cx" style="display: block; padding: 0 10px">                        $erasers_count = count( $erasers );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $request_id    = $item['request_id'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $request_id    = $item->ID;
</ins><span class="cx" style="display: block; padding: 0 10px">                         $nonce         = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $remove_data_markup = '<div class="remove_personal_data force_remove_personal_data" ' .
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1398,7 +1425,7 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return sprintf( '%1$s %2$s', $item['email'], $this->row_actions( $row_actions ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return sprintf( '%1$s %2$s', $item->email, $this->row_actions( $row_actions ) );
</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">@@ -1406,10 +1433,10 @@
</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 array $item Item being shown.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param WP_User_Request $item Item being shown.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function column_next_steps( $item ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $status = get_post_status( $item['request_id'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $status = $item->status;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                switch ( $status ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-pending':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1418,7 +1445,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-confirmed':
</span><span class="cx" style="display: block; padding: 0 10px">                                $erasers       = apply_filters( 'wp_privacy_personal_data_erasers', array() );
</span><span class="cx" style="display: block; padding: 0 10px">                                $erasers_count = count( $erasers );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $request_id    = $item['request_id'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $request_id    = $item->ID;
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $nonce         = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '<div class="remove_personal_data" ' .
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1436,12 +1463,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-failed':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item['request_id'] . ']', false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'request-completed':
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'action' => 'delete',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'request_id' => array( $item['request_id'] ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'request_id' => array( $item->ID ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>';
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span></span></pre></div>
<a id="branches49srcwpincludespostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.9/src/wp-includes/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-includes/post.php     2018-05-02 01:00:46 UTC (rev 43083)
+++ branches/4.9/src/wp-includes/post.php       2018-05-02 01:03:53 UTC (rev 43084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3800,7 +3800,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) || 'user_request' === $post_type )
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $slug;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        global $wpdb, $wp_rewrite;
</span></span></pre></div>
<a id="branches49srcwpincludesuserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.9/src/wp-includes/user.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-includes/user.php     2018-05-02 01:00:46 UTC (rev 43083)
+++ branches/4.9/src/wp-includes/user.php       2018-05-02 01:03:53 UTC (rev 43084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2762,13 +2762,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return;
</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">-        if ( ! in_array( $request_data['status'], array( 'request-pending', 'request-failed' ), true ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! in_array( $request_data->status, array( 'request-pending', 'request-failed' ), true ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 return;
</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">        update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() );
</span><span class="cx" style="display: block; padding: 0 10px">        wp_update_post( array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'ID'          => $request_data['request_id'],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'ID'          => $request_id,
</ins><span class="cx" style="display: block; padding: 0 10px">                 'post_status' => 'request-confirmed',
</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">@@ -2784,7 +2784,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function _wp_privacy_account_request_confirmed_message( $message, $request_id ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $request = wp_get_user_request_data( $request_id );
</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 ( $request && in_array( $request['action'], _wp_privacy_action_request_types(), true ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $message = '<p class="message">' . __( 'Action has been confirmed.' ) . '</p>';
</span><span class="cx" style="display: block; padding: 0 10px">                $message .= __( 'The site administrator has been notified and will fulfill your request as soon as possible.' );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2822,16 +2822,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Check for duplicates.
</span><span class="cx" style="display: block; padding: 0 10px">        $requests_query = new WP_Query( array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'post_type'   => 'user_request',
-               'title'       => $action_name,
-               'post_status' => 'any',
-               'fields'      => 'ids',
-               'meta_query'  => array(
-                       array(
-                               'key'     => '_wp_user_request_user_email',
-                               'value'   => $email_address,
-                       ),
-               ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'post_type'     => 'user_request',
+               'post_name__in' => array( $action_name ),  // Action name stored in post_name column.
+               'title'         => $email_address, // Email address stored in post_title column.
+               'post_status'   => 'any',
+               'fields'        => 'ids',
</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">        if ( $requests_query->found_posts ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2840,7 +2835,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $request_id = wp_insert_post( array(
</span><span class="cx" style="display: block; padding: 0 10px">                'post_author'   => $user_id,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'post_title'    => $action_name,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'post_name'     => $action_name,
+               'post_title'    => $email_address,
</ins><span class="cx" style="display: block; padding: 0 10px">                 'post_content'  => wp_json_encode( $request_data ),
</span><span class="cx" style="display: block; padding: 0 10px">                'post_status'   => 'request-pending',
</span><span class="cx" style="display: block; padding: 0 10px">                'post_type'     => 'user_request',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2848,13 +2844,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                'post_date_gmt' => current_time( 'mysql', true ),
</span><span class="cx" style="display: block; padding: 0 10px">        ), true );
</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 ( is_wp_error( $request_id ) ) {
-               return $request_id;
-       }
-
-       update_post_meta( $request_id, '_wp_user_request_user_email', $email_address );
-       update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', false );
-
</del><span class="cx" style="display: block; padding: 0 10px">         return $request_id;
</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">@@ -2883,9 +2872,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Filters the user action description.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @since 4.9.6
+        *
</ins><span class="cx" style="display: block; padding: 0 10px">          * @param string $description The default description.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $action_name The name of the request.
</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">         return apply_filters( 'user_request_action_description', $description, $action_name );
</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">@@ -2901,25 +2892,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_send_user_request( $request_id ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $request_id = absint( $request_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $request    = get_post( $request_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $request    = wp_get_user_request_data( $request_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( ! $request || 'user_request' !== $request->post_type ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $request ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 return new WP_Error( 'user_request_error', __( 'Invalid request.' ) );
</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">-        if ( 'request-pending' !== $request->post_status ) {
-               wp_update_post( array(
-                       'ID'            => $request_id,
-                       'post_status'   => 'request-pending',
-                       'post_date'     => current_time( 'mysql', false ),
-                       'post_date_gmt' => current_time( 'mysql', true ),
-               ) );
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px">         $email_data = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'action_name' => $request->post_title,
-               'email'       => get_post_meta( $request->ID, '_wp_user_request_user_email', true ),
-               'description' => wp_user_request_action_description( $request->post_title ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'email'       => $request->email,
+               'description' => wp_user_request_action_description( $request->action_name ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 'confirm_url' => add_query_arg( array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'action'      => 'confirmaction',
</span><span class="cx" style="display: block; padding: 0 10px">                        'request_id'  => $request_id,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2967,12 +2948,12 @@
</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="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         *     @type string $action_name Name of the action being performed.
-        *     @type string $email       The email address this is being sent to.
-        *     @type string $description Description of the action being performed so the user knows what the email is for.
-        *     @type string $confirm_url The link to click on to confirm the account action.
-        *     @type string $sitename    The site name sending the mail.
-        *     @type string $siteurl     The site URL sending the mail.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  *     @type WP_User_Request $request User request object.
+        *     @type string          $email       The email address this is being sent to.
+        *     @type string          $description Description of the action being performed so the user knows what the email is for.
+        *     @type string          $confirm_url The link to click on to confirm the account action.
+        *     @type string          $sitename    The site name sending the mail.
+        *     @type string          $siteurl     The site URL sending the mail.
</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">        $content = apply_filters( 'user_request_action_email_content', $email_text, $email_data );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2988,7 +2969,7 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Returns a confirmation key for a user action and stores the hashed version.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns a confirmation key for a user action and stores the hashed version for future comparison.
</ins><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><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3007,8 +2988,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $wp_hasher = new PasswordHash( 8, true );
</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">-        update_post_meta( $request_id, '_wp_user_request_confirm_key', $wp_hasher->HashPassword( $key ) );
-       update_post_meta( $request_id, '_wp_user_request_confirm_key_timestamp', time() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_update_post( array(
+               'ID'                => $request_id,
+               'post_status'       => 'request-pending',
+               'post_password'     => $wp_hasher->HashPassword( $key ),
+               'post_modified'     => current_time( 'mysql', false ),
+               'post_modified_gmt' => current_time( 'mysql', true ),
+       ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        return $key;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3032,7 +3018,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return new WP_Error( 'user_request_error', __( 'Invalid request.' ) );
</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">-        if ( ! in_array( $request['status'], array( 'request-pending', 'request-failed' ), true ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 return __( 'This link has expired.' );
</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">@@ -3045,8 +3031,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $wp_hasher = new PasswordHash( 8, true );
</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">-        $key_request_time = $request['confirm_key_timestamp'];
-       $saved_key        = $request['confirm_key'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $key_request_time = $request->modified_timestamp;
+       $saved_key        = $request->confirm_key;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! $saved_key ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return new WP_Error( 'invalid_key', __( 'Invalid key' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3087,23 +3073,119 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_get_user_request_data( $request_id ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $request_id = absint( $request_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $request    = get_post( $request_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post       = get_post( $request_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( ! $request || 'user_request' !== $request->post_type ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $post || 'user_request' !== $post->post_type ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 return false;
</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">-        return array(
-               'request_id'            => $request->ID,
-               'user_id'               => $request->post_author,
-               'email'                 => get_post_meta( $request->ID, '_wp_user_request_user_email', true ),
-               'action'                => $request->post_title,
-               'requested_timestamp'   => strtotime( $request->post_date_gmt ),
-               'confirmed_timestamp'   => get_post_meta( $request->ID, '_wp_user_request_confirmed_timestamp', true ),
-               'completed_timestamp'   => get_post_meta( $request->ID, '_wp_user_request_completed_timestamp', true ),
-               'request_data'          => json_decode( $request->post_content, true ),
-               'status'                => $request->post_status,
-               'confirm_key'           => get_post_meta( $request_id, '_wp_user_request_confirm_key', true ),
-               'confirm_key_timestamp' => get_post_meta( $request_id, '_wp_user_request_confirm_key_timestamp', true ),
-       );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return new WP_User_Request( $post );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * WP_User_Request class.
+ *
+ * Represents user request data loaded from a WP_Post object.
+ *
+ * @since 4.9.6
+ */
+final class WP_User_Request {
+       /**
+        * Request ID.
+        *
+        * @var int
+        */
+       public $ID = 0;
+
+       /**
+        * User ID.
+        *
+        * @var int
+        */
+
+       public $user_id = 0;
+
+       /**
+        * User email.
+        *
+        * @var int
+        */
+       public $email = '';
+
+       /**
+        * Action name.
+        *
+        * @var string
+        */
+       public $action_name = '';
+
+       /**
+        * Current status.
+        *
+        * @var string
+        */
+       public $status = '';
+
+       /**
+        * Timestamp this request was created.
+        *
+        * @var int|null
+        */
+       public $created_timestamp = null;
+
+       /**
+        * Timestamp this request was last modified.
+        *
+        * @var int|null
+        */
+       public $modified_timestamp = null;
+
+       /**
+        * Timestamp this request was confirmed.
+        *
+        * @var int
+        */
+       public $confirmed_timestamp = null;
+
+       /**
+        * Timestamp this request was completed.
+        *
+        * @var int
+        */
+       public $completed_timestamp = null;
+
+       /**
+        * Misc data assigned to this request.
+        *
+        * @var array
+        */
+       public $request_data = array();
+
+       /**
+        * Key used to confirm this request.
+        *
+        * @var string
+        */
+       public $confirm_key = '';
+
+       /**
+        * Constructor.
+        *
+        * @since 4.9.6
+        *
+        * @param WP_Post|object $post Post object.
+        */
+       public function __construct( $post ) {
+               $this->ID                  = $post->ID;
+               $this->user_id             = $post->post_author;
+               $this->email               = $post->post_title;
+               $this->action_name         = $post->post_name;
+               $this->status              = $post->post_status;
+               $this->created_timestamp   = strtotime( $post->post_date_gmt );
+               $this->modified_timestamp  = strtotime( $post->post_modified_gmt );
+               $this->confirmed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_confirmed_timestamp', true );
+               $this->completed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_completed_timestamp', true );
+               $this->request_data        = json_decode( $post->post_content, true );
+               $this->confirm_key         = $post->post_password;
+       }
+}
</ins></span></pre>
</div>
</div>

</body>
</html>