WordPress.org

Make WordPress Core

Ticket #44000: 44000.3.diff

File 44000.3.diff, 1.7 KB (added by birgire, 5 weeks ago)
  • src/wp-admin/menu.php

    diff --git src/wp-admin/menu.php src/wp-admin/menu.php
    index 0ad302e..4d0afb7 100644
    if ( current_user_can( 'list_users' ) ) { 
    252252        }
    253253}
    254254
    255 $menu[75]                     = array( __( 'Tools' ), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
     255$confirmed_export_request_count = 0;
     256if ( current_user_can( 'export_others_personal_data' ) ) {
     257        $export_request_counts = (array) wp_count_user_requests( 'export_personal_data' );
     258        if ( isset( $export_request_counts['request-confirmed'] ) ) {
     259                $confirmed_export_request_count = (int) $export_request_counts['request-confirmed'];
     260        }
     261}
     262
     263$confirmed_erase_request_count = 0;
     264if ( current_user_can( 'erase_others_personal_data' ) ) {
     265        $erase_request_counts = (array) wp_count_user_requests( 'remove_personal_data' );
     266        if ( isset( $erase_request_counts['request-confirmed'] ) ) {
     267                $confirmed_erase_request_count = (int) $erase_request_counts['request-confirmed'];
     268        }
     269}
     270
     271$confirmed_request_count = $confirmed_export_request_count + $confirmed_erase_request_count;
     272
     273$request_notice = sprintf(
     274        '<span class="update-plugins count-%d"><span class="plugin-count">%d</span></span>',
     275        $confirmed_request_count,
     276        number_format_i18n( $confirmed_request_count )
     277);
     278
     279$menu[75]                     = array( sprintf( __( 'Tools %s' ), $request_notice ), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
    256280        $submenu['tools.php'][5]  = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
    257281        $submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
    258282        $submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );