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/core/update.php

    r6896 r6897  
    531531
    532532    // Maybe add upgrade ID to end of pending array
    533     if ( ! isset( $pending[ $upgrade_id ] ) ) {
     533    if ( false === array_search( $upgrade_id, $pending, true ) ) {
    534534        array_push( $pending, $upgrade_id );
    535535    }
     
    568568    return delete_option( '_bbp_db_pending_upgrades' );
    569569}
     570
     571/**
     572 * Maybe append an upgrade count to a string
     573 *
     574 * @since 2.6.0 bbPress (r6896)
     575 *
     576 * @param string $string
     577 *
     578 * @return string
     579 */
     580function bbp_maybe_append_pending_upgrade_count( $string = '' ) {
     581
     582    // Look for an upgrade count
     583    $count = bbp_get_pending_upgrade_count();
     584
     585    // Append the count to the string
     586    if ( ! empty( $count ) ) {
     587        $suffix = ' <span class="awaiting-mod count-' . absint( $count ) . '"><span class="pending-count">' . bbp_number_format( $count ) . '</span></span>';
     588        $string = "{$string}{$suffix}";
     589    }
     590
     591    // Return the string, maybe with a count
     592    return $string;
     593}
Note: See TracChangeset for help on using the changeset viewer.