<!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>[43225] branches/4.9/src: Privacy: Replace intrusive policy update notice with menu bubbles.</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/43225">43225</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/43225","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-05-10 20:07:11 +0000 (Thu, 10 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: Replace intrusive policy update notice with menu bubbles.
Previously, when a plugin updated its suggested privacy policy text, an admin notice was shown on all screens in the Administration Panels. That was done in order to make sure that administrators were aware of it, so that they could update their policy if needed. That was a very heavy-handed and intrusive approach, though, which leads to a poor user experience, and notice fatigue.
An alternative approach is to use bubble notifications in the menu, similar to when plugins have updates that need to be installed. That still makes it obvious that something needs the administrator's attention, but is not as distracting as a notice.
The notice will still appear on the Privacy page, though, since it is relevant to that screen, and provides an explanation of why the bubble is appearing.
Props azaozz, xkon, iandunn.
Merges <a href="https://core.trac.wordpress.org/changeset/43223">[43223]</a> to the 4.9 branch.
Fixes <a href="https://core.trac.wordpress.org/ticket/43954">#43954</a>. See <a href="https://core.trac.wordpress.org/ticket/43953">#43953</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches49srcwpadmincssformscss">branches/4.9/src/wp-admin/css/forms.css</a></li>
<li><a href="#branches49srcwpadminincludesadminfiltersphp">branches/4.9/src/wp-admin/includes/admin-filters.php</a></li>
<li><a href="#branches49srcwpadminincludesmiscphp">branches/4.9/src/wp-admin/includes/misc.php</a></li>
<li><a href="#branches49srcwpadminmenuphp">branches/4.9/src/wp-admin/menu.php</a></li>
<li><a href="#branches49srcwpincludesdefaultfiltersphp">branches/4.9/src/wp-includes/default-filters.php</a></li>
<li><a href="#branches49srcwpincludesfunctionsphp">branches/4.9/src/wp-includes/functions.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-10 19:53:18 UTC (rev 43224)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/4.9 2018-05-10 20:07:11 UTC (rev 43225)
</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,42697,42711,42713,42719,42722,42739-42740,42744,42758,42772,42791-42792,42801,42814-42815,42817-42818,42823,42830,42837,42839,42841,42844,42851-42852,42860,42864,42881,42888-42889,42892-42894,42930,42964,42967,42971
-42972,42977-42978,42980,42985-42987,42989,42992,42994-42995,42998-42999,43001-43004,43007-43008,43011-43012,43014-43015,43025,43027,43030,43032,43034,43036,43039,43042,43044-43048,43052-43063,43065,43081,43085,43088-43089,43091,43104,43116,43118,43120-43121,43123,43125-43126,43131-43132,43135,43137,43139,43145-43148,43150,43154-43155,43158,43160,43162,43166,43168,43170,43172,43175,43180-43181,43183-43185,43189,43191,43193,43195,43197,43199,43201,43203,43206,43208,43210-43212,43216,43218,43220,43222
</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,42697,42711,42713,42719,42722,42739-42740,42744,42758,42772,42791-42792,42801,42814-42815,42817-42818,42823,42830,42837,42839,42841,42844,42851-42852,42860,42864,42881,42888-42889,42892-42894,42930,42964,42967,42971
-42972,42977-42978,42980,42985-42987,42989,42992,42994-42995,42998-42999,43001-43004,43007-43008,43011-43012,43014-43015,43025,43027,43030,43032,43034,43036,43039,43042,43044-43048,43052-43063,43065,43081,43085,43088-43089,43091,43104,43116,43118,43120-43121,43123,43125-43126,43131-43132,43135,43137,43139,43145-43148,43150,43154-43155,43158,43160,43162,43166,43168,43170,43172,43175,43180-43181,43183-43185,43189,43191,43193,43195,43197,43199,43201,43203,43206,43208,43210-43212,43216,43218,43220,43222-43223
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches49srcwpadmincssformscss"></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/css/forms.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-admin/css/forms.css 2018-05-10 19:53:18 UTC (rev 43224)
+++ branches/4.9/src/wp-admin/css/forms.css 2018-05-10 20:07:11 UTC (rev 43225)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1089,7 +1089,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"> .tools-privacy-edit {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- margin: 2.3em 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ margin: 1.5em 0;
</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"> .tools-privacy-policy-page span {
</span></span></pre></div>
<a id="branches49srcwpadminincludesadminfiltersphp"></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/admin-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-admin/includes/admin-filters.php 2018-05-10 19:53:18 UTC (rev 43224)
+++ branches/4.9/src/wp-admin/includes/admin-filters.php 2018-05-10 20:07:11 UTC (rev 43225)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -138,7 +138,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_privacy_personal_data_export_file', 'wp_privacy_generate_personal_data_export_file', 10 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Privacy policy text changes check.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'text_change_check' ), 20 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'text_change_check' ), 100 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Show a "postbox" with the text suggestions for a privacy policy.
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'edit_form_after_title', array( 'WP_Privacy_Policy_Content', 'notice' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -146,6 +146,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Add the suggested policy text from WordPress.
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_content' ), 1 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Stop checking for text changes after the policy page is updated.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// Update the cached policy info when the policy page is updated.
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches49srcwpadminincludesmiscphp"></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/misc.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-admin/includes/misc.php 2018-05-10 19:53:18 UTC (rev 43224)
+++ branches/4.9/src/wp-admin/includes/misc.php 2018-05-10 20:07:11 UTC (rev 43225)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1271,23 +1271,40 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // The site doesn't have a privacy policy.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $policy_page_id ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return 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"> if ( ! current_user_can( 'edit_post', $policy_page_id ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
</ins><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">- // Also run when the option doesn't exist yet.
- if ( get_option( '_wp_privacy_text_change_check' ) === 'no-check' ) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
+
+ // Updates are not relevant if the user has not reviewed any suggestions yet.
+ if ( empty( $old ) ) {
+ return false;
</ins><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">- $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $cached = get_option( '_wp_suggested_policy_text_has_changed' );
+
+ /*
+ * When this function is called before `admin_init`, `self::$policy_content`
+ * has not been populated yet, so use the cached result from the last
+ * execution instead.
+ */
+ if ( ! did_action( 'admin_init' ) ) {
+ return 'changed' === $cached;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $new = self::$policy_content;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove the extra values added to the meta.
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $old as $key => $data ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $data['removed'] ) ) {
+ unset( $old[ $key ] );
+ continue;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $old[ $key ] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'plugin_name' => $data['plugin_name'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'policy_text' => $data['policy_text'],
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1294,39 +1311,47 @@
</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">+ // Normalize the order of texts, to facilitate comparison.
+ sort( $old );
+ sort( $new );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // The == operator (equal, not identical) was used intentionally.
</span><span class="cx" style="display: block; padding: 0 10px"> // See http://php.net/manual/en/language.operators.array.php
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $new != $old ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // A plugin was activated or deactivated, or some policy text has changed.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Show a notice on all screens in wp-admin.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Show a notice on the relevant screens to inform the admin.
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $state = 'changed';
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Stop checking.
- update_option( '_wp_privacy_text_change_check', 'no-check' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $state = 'not-changed';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Cache the result for use before `admin_init` (see above).
+ if ( $cached !== $state ) {
+ update_option( '_wp_suggested_policy_text_has_changed', $state );
+ }
+
+ return 'changed' === $state;
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Output an admin notice when some privacy info has changed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Output a warning when some privacy info has changed.
</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="cx" style="display: block; padding: 0 10px"> public static function policy_text_changed_notice() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $post;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $screen = get_current_screen()->id;
+
+ if ( 'privacy' !== $screen ) {
+ return;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="policy-text-updated notice notice-warning is-dismissible">
</span><span class="cx" style="display: block; padding: 0 10px"> <p><?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- _e( 'The suggested privacy policy text has changed.' );
-
- if ( empty( $post ) || $post->ID != $policy_page_id ) {
- ?>
- <a href="<?php echo get_edit_post_link( $policy_page_id ); ?>"><?php _e( 'Edit the privacy policy.' ); ?></a>
- <?php
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _e( 'The suggested privacy policy text has changed. Please update your privacy policy.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> ?></p>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1333,7 +1358,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">- * Stop checking for changed privacy info when the policy page is updated.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Update the cached policy info when the policy page is updated.
</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"> * @access private
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1345,9 +1370,8 @@
</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">- // The policy page was updated.
- // Stop checking for text changes.
- update_option( '_wp_privacy_text_change_check', 'no-check' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Update the cache in case the user hasn't visited the policy guide.
+ self::get_suggested_policy_text();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove updated|removed status.
</span><span class="cx" style="display: block; padding: 0 10px"> $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1447,7 +1471,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $new as $new_data ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $new_data['plugin_name'] ) && ! empty( $new_data['policy_text'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $new_data['added'] = $time;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array_unshift( $checked, $new_data );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $checked[] = $new_data;
</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"> $update_cache = true;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1462,7 +1486,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'policy_text' => $old_data['policy_text'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'removed' => $time,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array_unshift( $checked, $data );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $checked[] = $data;
</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"> $update_cache = true;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1476,11 +1501,6 @@
</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">- // Stop checking for changes after the page has been loaded.
- if ( get_option( '_wp_privacy_text_change_check' ) !== 'no-check' ) {
- update_option( '_wp_privacy_text_change_check', 'no-check' );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> return $checked;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches49srcwpadminmenuphp"></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/menu.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-admin/menu.php 2018-05-10 19:53:18 UTC (rev 43224)
+++ branches/4.9/src/wp-admin/menu.php 2018-05-10 20:07:11 UTC (rev 43225)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -249,15 +249,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )
</span><span class="cx" style="display: block; padding: 0 10px"> $submenu['tools.php'][50] = array(__('Network Setup'), 'setup_network', 'network.php');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
- $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
- $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
- $submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
- $submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
- $submenu['options-general.php'][30] = array(__('Media'), 'manage_options', 'options-media.php');
- $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
- $submenu['options-general.php'][45] = array( __( 'Privacy' ), 'manage_privacy_options', 'privacy.php' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$change_notice = '';
+if ( current_user_can( 'manage_privacy_options' ) && WP_Privacy_Policy_Content::text_change_check() ) {
+ $change_notice = ' <span class="update-plugins 1"><span class="plugin-count">' . number_format_i18n( 1 ) . '</span></span>';
+}
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// translators: %s is the update notification bubble, if updates are available.
+$menu[80] = array( sprintf( __( 'Settings %s' ), $change_notice ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
+ $submenu['options-general.php'][10] = array( _x( 'General', 'settings screen' ), 'manage_options', 'options-general.php' );
+ $submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' );
+ $submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' );
+ $submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' );
+ $submenu['options-general.php'][30] = array( __( 'Media' ), 'manage_options', 'options-media.php' );
+ $submenu['options-general.php'][40] = array( __( 'Permalinks' ), 'manage_options', 'options-permalink.php' );
+ // translators: %s is the update notification bubble, if updates are available.
+ $submenu['options-general.php'][45] = array( sprintf( __( 'Privacy %s' ), $change_notice ), 'manage_privacy_options', 'privacy.php' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator' );
</span></span></pre></div>
<a id="branches49srcwpincludesdefaultfiltersphp"></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/default-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-includes/default-filters.php 2018-05-10 19:53:18 UTC (rev 43224)
+++ branches/4.9/src/wp-includes/default-filters.php 2018-05-10 20:07:11 UTC (rev 43225)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -535,8 +535,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Capabilities
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Trigger the check for policy text changes after active plugins change.
-add_action( 'update_site_option_active_sitewide_plugins', '_wp_privacy_active_plugins_change' );
-add_action( 'update_option_active_plugins', '_wp_privacy_active_plugins_change' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> unset( $filter, $action );
</span></span></pre></div>
<a id="branches49srcwpincludesfunctionsphp"></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/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.9/src/wp-includes/functions.php 2018-05-10 19:53:18 UTC (rev 43224)
+++ branches/4.9/src/wp-includes/functions.php 2018-05-10 20:07:11 UTC (rev 43225)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5937,16 +5937,6 @@
</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">- * Trigger the check for policy text changes.
- *
- * @since 4.9.6
- * @access private
- */
-function _wp_privacy_active_plugins_change() {
- update_option( '_wp_privacy_text_change_check', 'check' );
-}
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * Schedule a `WP_Cron` job to delete expired export files.
</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></pre>
</div>
</div>
</body>
</html>