Make WordPress Core


Ignore:
Timestamp:
05/10/2018 08:07:11 PM (6 years ago)
Author:
azaozz
Message:

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 [43223] to the 4.9 branch.
Fixes #43954. See #43953.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/menu.php

    r43156 r43225  
    250250        $submenu['tools.php'][50] = array(__('Network Setup'), 'setup_network', 'network.php');
    251251
    252 $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
    253     $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
    254     $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
    255     $submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
    256     $submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
    257     $submenu['options-general.php'][30] = array(__('Media'), 'manage_options', 'options-media.php');
    258     $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
    259     $submenu['options-general.php'][45] = array( __( 'Privacy' ), 'manage_privacy_options', 'privacy.php' );
     252$change_notice = '';
     253if ( current_user_can( 'manage_privacy_options' ) && WP_Privacy_Policy_Content::text_change_check() ) {
     254    $change_notice = ' <span class="update-plugins 1"><span class="plugin-count">' . number_format_i18n( 1 ) . '</span></span>';
     255}
     256
     257// translators: %s is the update notification bubble, if updates are available.
     258$menu[80]                               = array( sprintf( __( 'Settings %s' ), $change_notice ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
     259    $submenu['options-general.php'][10] = array( _x( 'General', 'settings screen' ), 'manage_options', 'options-general.php' );
     260    $submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' );
     261    $submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' );
     262    $submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' );
     263    $submenu['options-general.php'][30] = array( __( 'Media' ), 'manage_options', 'options-media.php' );
     264    $submenu['options-general.php'][40] = array( __( 'Permalinks' ), 'manage_options', 'options-permalink.php' );
     265    // translators: %s is the update notification bubble, if updates are available.
     266    $submenu['options-general.php'][45] = array( sprintf( __( 'Privacy %s' ), $change_notice ), 'manage_privacy_options', 'privacy.php' );
    260267
    261268$_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
Note: See TracChangeset for help on using the changeset viewer.