Skip to:
Content

bbPress.org


Ignore:
Timestamp:
01/29/2019 04:38:37 AM (6 years ago)
Author:
johnjamesjacoby
Message:

Upgrades: append upgrade count to "Tools" if there are pending upgrades

  • Add function and method to tweak the $menu global
  • Add styling for count in nav-tab-wrapper UI

This change adds a span.awaiting-mod wrapper around the pending upgrade count in a few strategic locations around the WordPress Admin UI.

See #3244.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/classes/class-bbp-admin.php

    r6896 r6897  
    169169        add_action( 'bbp_admin_init',    array( $this, 'hide_notices'   ) );
    170170        add_action( 'bbp_admin_notices', array( $this, 'output_notices' ) );
     171
     172        /** Upgrades **********************************************************/
     173
     174        add_action( 'bbp_admin_init', array( $this, 'add_upgrade_count' ) );
    171175
    172176        /** Ajax **************************************************************/
     
    387391
    388392    /**
     393     * Maybe append the pending upgrade count to the "Tools" menu.
     394     *
     395     * @since 2.6.0 bbPress (r6896)
     396     *
     397     * @global menu $menu
     398     */
     399    public function add_upgrade_count() {
     400        global $menu;
     401
     402        foreach ( $menu as $menu_index => $menu_item ) {
     403            $found = array_search( 'tools.php', $menu_item, true );
     404
     405            if ( false !== $found ) {
     406                $menu[ $menu_index ][ 0 ] = bbp_maybe_append_pending_upgrade_count( $menu[ $menu_index ][ 0 ] );
     407                continue;
     408            }
     409        }
     410    }
     411
     412    /**
    389413     * Add the admin menus
    390414     *
     
    424448        add_management_page(
    425449            esc_html__( 'Forums', 'bbpress' ),
    426             esc_html__( 'Forums', 'bbpress' ),
     450            bbp_maybe_append_pending_upgrade_count( esc_html__( 'Forums', 'bbpress' ) ),
    427451            'bbp_tools_page',
    428452            'bbp-repair',
Note: See TracChangeset for help on using the changeset viewer.