From 97eeed489d95fcb15bf973cd27da8866bac852bb Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Thu, 3 May 2018 19:44:36 +0000 Subject: [PATCH] Privacy: Add an admin pointer for new privacy features in 4.9.6. The new features are very important for some users, because of their GDPR obligations. They're also spread across multiple top-level menus, making them less discoverable. An admin pointer will help to ensure that users are aware of the new tools and how to find them. Props desrosj, andreamiddleton, allendav, xkon. Fixes #43942. git-svn-id: https://develop.svn.wordpress.org/trunk@43158 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-internal-pointers.php | 41 ++++++++++++++++++- src/wp-includes/css/wp-pointer.css | 4 ++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-internal-pointers.php b/src/wp-admin/includes/class-wp-internal-pointers.php index 4251df3b8a..30f3d85db1 100644 --- a/src/wp-admin/includes/class-wp-internal-pointers.php +++ b/src/wp-admin/includes/class-wp-internal-pointers.php @@ -41,7 +41,7 @@ final class WP_Internal_Pointers { * ) */ $registered_pointers = array( - // None currently + 'index.php' => 'wp496_privacy', ); // Check if screen related pointer is registered @@ -65,7 +65,11 @@ final class WP_Internal_Pointers { * ) */ $caps_required = array( - // None currently + 'wp496_privacy' => array( + 'manage_privacy_options', + 'export_others_personal_data', + 'erase_others_personal_data', + ), ); // Get dismissed pointers @@ -151,6 +155,39 @@ final class WP_Internal_Pointers { public static function pointer_wp390_widgets() {} public static function pointer_wp410_dfw() {} + /** + * Display a pointer for the new privacy tools. + * + * @since 4.9.6 + */ + public static function pointer_wp496_privacy() { + $content = '

' . __( 'Privacy and Personal Data' ) . '

'; + $content .= '

' . __( 'Privacy Policy' ) . '

'; + $content .= '

' . __( 'Create or select your site’s privacy policy page under Settings > Privacy to keep your users informed and aware.' ) . '

'; + $content .= '

' . __( 'Personal Data Export and Erasure' ) . '

'; + $content .= '

' . __( 'New Tools have been added to help you with personal data export and erasure requests.' ) . '

'; + + if ( is_rtl() ) { + $position = array( + 'edge' => 'right', + 'align' => 'left', + 'at' => 'left+40', + ); + } else { + $position = array( + 'edge' => 'left', + 'align' => 'right', + 'at' => 'right-40 bottom' + ); + } + + $js_args = array( + 'content' => $content, + 'position' => $position, + ); + self::print_js( 'wp496_privacy', '#menu-tools', $js_args ); + } + /** * Prevents new users from seeing existing 'new feature' pointers. * diff --git a/src/wp-includes/css/wp-pointer.css b/src/wp-includes/css/wp-pointer.css index ed37b8443c..a0be97b4cc 100644 --- a/src/wp-includes/css/wp-pointer.css +++ b/src/wp-includes/css/wp-pointer.css @@ -36,6 +36,10 @@ -moz-osx-font-smoothing: grayscale; } +.wp-pointer-content h4 { + margin: 1.33em 15px; +} + .wp-pointer-content p { padding: 0 15px; }