Privacy: fixes for the privacy policy guide and suggested content:

- Separate the guide text form the suggested policy text.
- Add table of content for easier navigation.
- Move the content to tools.php (prevents the settings menu of being open).
- Add a link to the guide from the Privacy settings screen.

Props melchoyce, azaozz.
See #43980.

git-svn-id: https://develop.svn.wordpress.org/trunk@43203 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2018-05-09 20:50:54 +00:00
parent da40024f7f
commit 80333a91e2
4 changed files with 165 additions and 119 deletions
+20 -28
View File
@@ -13,13 +13,6 @@ if ( ! current_user_can( 'manage_privacy_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) );
}
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
}
// "Borrow" xfn.js for now so we don't have to create new files.
wp_enqueue_script( 'xfn' );
$action = isset( $_POST['action'] ) ? $_POST['action'] : '';
if ( ! empty( $action ) ) {
@@ -41,6 +34,10 @@ if ( ! empty( $action ) ) {
);
} elseif ( 'create-privacy-page' === $action ) {
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
}
$privacy_policy_page_content = WP_Privacy_Policy_Content::get_default_content();
$privacy_policy_page_id = wp_insert_post(
array(
@@ -105,20 +102,6 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
<div class="wrap">
<?php
if ( isset( $_GET['wp-suggested-policy-content'] ) ) {
?>
<h1><?php _e( 'Privacy Policy Guide' ); ?></h1>
<div class="wp-suggested-policy-content">
<?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
</div>
<?php
} else {
?>
<h1><?php _e( 'Privacy Settings' ); ?></h1>
<h2><?php _e( 'Privacy Policy page' ); ?></h2>
<p>
@@ -134,6 +117,7 @@ if ( isset( $_GET['wp-suggested-policy-content'] ) ) {
<?php _e( 'We would also suggest reviewing your privacy policy from time to time, especially after an update. There may be changes or new suggested information for you to consider adding to your policy.' ); ?>
</p>
<?php
if ( $privacy_policy_page_exists ) {
$edit_href = add_query_arg(
array(
@@ -144,17 +128,26 @@ if ( isset( $_GET['wp-suggested-policy-content'] ) ) {
);
$view_href = get_permalink( $privacy_policy_page_id );
?>
<p class="tools-privacy-edit"><strong>
<?php
printf(
/* translators: 1: URL to edit page, 2: URL to view page */
__( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy page content.' ),
$edit_href,
$view_href
);
/* translators: 1: URL to edit page, 2: URL to view page */
printf( __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy page content.' ), $edit_href, $view_href );
?>
</strong></p>
<p>
<?php
printf(
__( 'Need help putting together your new Privacy Policy page? %s for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
'<a href="' . admin_url( 'tools.php?wp-privacy-policy-guide' ) . '">' . __( 'Check out our guide' ) . '</a>'
);
?>
</p>
<?php
}
?>
@@ -209,6 +202,5 @@ if ( isset( $_GET['wp-suggested-policy-content'] ) ) {
</table>
</div>
<?php
} // End if/else isset( $_GET['wp-suggested-policy-content'] ).
include( ABSPATH . 'wp-admin/admin-footer.php' );