WordPress.org

Make WordPress Core

Ticket #44000: 44000.2.diff

File 44000.2.diff, 2.3 KB (added by birgire, 6 weeks ago)
  • src/wp-admin/css/admin-menu.css

    diff --git src/wp-admin/css/admin-menu.css src/wp-admin/css/admin-menu.css
    index 9c09dac..e75cb88 100644
    ul#adminmenu > li.current > a.current:after { 
    512512
    513513/* @todo: consider to use a single rule for these counters and the list table comments counters. */
    514514#adminmenu .awaiting-mod,
    515 #adminmenu .update-plugins {
     515#adminmenu .update-plugins,
     516#adminmenu .awaiting-confirmed-request-mod {
    516517        display: inline-block;
    517518        vertical-align: top;
    518519        margin: 1px 0 0 2px;
  • src/wp-admin/includes/user.php

    diff --git src/wp-admin/includes/user.php src/wp-admin/includes/user.php
    index 7694889..8864a7f 100644
    function _wp_personal_data_export_page() { 
    843843        <?php
    844844}
    845845
     846add_filter( 'add_menu_classes', '_wp_export_erase_request_bubble' );
     847
     848/**
     849 * Admin menu bubble for data export and erase requests.
     850 *
     851 * @since 4.9.7
     852 *
     853 * @param array $menu Menu array.
     854 */
     855
     856function _wp_export_erase_request_bubble( $menu ) {
     857       
     858        $confirmed_export_request_counts = 0;
     859        if ( current_user_can( 'export_others_personal_data' ) ) {
     860                $export_request_counts = (array) wp_count_user_requests( 'export_personal_data' );
     861                if( isset( $export_request_counts['request-confirmed'] ) ) {
     862                        $confirmed_export_request_counts = (int) $export_request_counts['request-confirmed'];
     863                }
     864        }
     865               
     866        $confirmed_erase_request_counts = 0;
     867        if ( current_user_can( 'erase_others_personal_data' ) ) {
     868                $erase_request_counts = (array) wp_count_user_requests( 'remove_personal_data' );
     869                if( isset( $erase_request_counts['request-confirmed'] ) ) {
     870                        $confirmed_erase_request_counts = (int) $erase_request_counts['request-confirmed'];
     871                }
     872        }
     873       
     874        $request_count = $confirmed_export_request_counts + $confirmed_erase_request_counts;
     875                       
     876        // Loop through menu items
     877        foreach( $menu as $menu_key => $menu_data ){
     878                // If not the Tools menu, continue
     879                if( 'tools.php' != $menu_data[2] )
     880                        continue;
     881                // On Tools menu add the bubble with the $request_count calculated above.
     882                $menu[$menu_key][0] .= sprintf(
     883                        ' <span class="awaiting-confirmed-request-mod count-%d"><span class="confirmed-request-count">%d</span></span>',
     884                        $request_count,
     885                        number_format_i18n( $request_count )
     886                );
     887        }
     888        return $menu;
     889}
     890
    846891/**
    847892 * Personal data anonymization.
    848893 *