Notifications for Collapsed Admin Menu

Περιγραφή

In the WordPress admin, when the left sidebar menu is expanded WordPress presents you with a highlighted number within the menu itself indicating the number of pending comments (i.e. comments in moderation) and a separate number for the number of plugins with updates.

However, if you collapse the sidebar menu, then there are no visual indications that either types of updates are available. You can view the count of updated plugins by hovering on the plugins icon (or, for comments, by hovering on the comments icon), but you must manually do that to learn of updates.

This plugin enhances the sidebar menu to display a visual indication that comments are in moderation and/or there are plugin updates available. It does so by using a different-colored background for the icon (see the screenshot). The visual indication is also updated when AJAX-based requests are made (so doing an in-line approval of the last pending comment will cause the comments icon background color to return to its non-highlighted color).

By default, the plugin utilizes WordPress’s pending/update count background highlight color, which varies depending on the admin color scheme in use by the user.

NOTE: As the plugin’s name suggests, this plugin only takes effect if the admin sidebar menu is collapsed. Also, the admin user must have JavaScript enabled.

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Στιγμιότυπα

  • A comparison of a collapsed admin sidebar menu for a stock WordPress installation, with the plugin activated under WP 2.8+/2.9+, and under WP 3.x+ and WP 4.x+.

Εγκατάσταση

  1. Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically /wp-content/plugins/).
  2. Activate the plugin through the ‘Plugins’ admin menu in WordPress

Συχνές Ερωτήσεις

Why doesn’t this plugin apply when the admin sidebar menu is expanded?

There is no need for this plugin to do anything in this situation because WordPress already presents a visible count of pending comments and plugins with updates.

Can I change the background color used to highlight the comments/plugins icons?

Yes. You can customize the background color used by applying a filter to ‘c2c_collapsed_admin_menu_icon_highlight_color’. For example, in your theme’s functions.php file, you can add this line (but replace “#9932CC” with the color you want):

add_filter( 'c2c_collapsed_admin_menu_icon_highlight_color', function( $color ) { return "#9932CC"; } );

Or, you can make use of my Add Admin CSS plugin to define CSS to override the background color using this snippet of CSS (once again, replace “#9932CC” with the color you want):

`css

/* Override the highlight color used by the plugin Notifications for Collapsed Admin Menu. */
:root {
–collapsed-admin-icon-highlight-color: #9932CC;
}
.folded #adminmenu li.collapsed-with-pending {
background-color: var(–collapsed-admin-icon-highlight-color);
border-left-color: var(–collapsed-admin-icon-highlight-color);
border-right-color: var(–collapsed-admin-icon-highlight-color);
}
`

Does this plugin include unit tests?

Yes.

Κριτικές

Δεν υπάρχουν αξιολογήσεις για αυτό το πρόσθετο.

Συνεισφέροντες & Προγραμματιστές

“Notifications for Collapsed Admin Menu” είναι λογισμικό ανοιχτού κώδικα. Οι παρακάτω έχουν συνεισφέρει στη δημιουργία του.

Συντελεστές

Σύνοψη αλλαγών

1.6 (2021-10-22)

Highlights:

This minor release adds support for other menu items that may have a count indicator, prevents potential JS errors, notes compatibility through WP 5.8+, and minor reorganization and tweaks to unit tests.

Details:

  • New: Add support for other menu items that borrow the plugin count indicator markup for their own count indicator
  • Fix: Change __wakeup() method visibility from private to public to avoid warnings under PHP8
  • Fix: Throw an error when attempting to unserialize an instance of the class to actually prevent it from happening
  • Change: Prevent potential JavaScript errors
  • Change: Amend FAQ to also suggest and explain use of Add Admin CSS plugin to customize highlight color as an alternative to setting color via filter
  • Change: Tweak installation instruction
  • Change: Note compatibility through WP 5.8+
  • Change: Reduce the number of plugin tags in readme.txt
  • Change: Restructure unit test file structure
    • Change: Restructure unit test directories
      • Change: Move phpunit/ into tests/phpunit/
      • Change: Move phpunit/bin/ into tests/
    • Change: Remove ‘test-‘ prefix from unit test file
    • Change: In bootstrap, store path to plugin file constant
    • Change: In bootstrap, add backcompat for PHPUnit pre-v6.0
  • New: Add a few more possible TODO items

1.5.1 (2021-04-12)

  • Change: Note compatibility through WP 5.7+
  • Change: Update copyright date (2021)

1.5 (2020-09-01)

Highlights:

This minor update features a rewrite of the JavaScript to use vanilla JS instead of jQuery, restructures the unit test file structure, notes compatibility through WP 5.5+, and a few behind-the-scenes changes.

Details:

  • Change: Rewrite JavaScript into vanilla JS and away from using jQuery
  • Change: Add $admin_color as second arg to c2c_collapsed_admin_menu_icon_highlight_color filter
  • Change: Remove check for theme support of HTML5 since that isn’t relevant to admin
  • Change: Restructure unit test file structure
    • New: Create new subdirectory phpunit/ to house all files related to unit testing
    • Change: Move bin/ to phpunit/bin/
    • Change: Move tests/bootstrap.php to phpunit/
    • Change: Move tests/ to phpunit/tests/
    • Change: Rename phpunit.xml to phpunit.xml.dist per best practices
  • Change: Note compatibility through WP 5.5+
  • New: Add FAQ indicating presence of unit tests
  • Unit tests:
    • New: Add tests for filter c2c_collapsed_admin_menu_icon_highlight_color
    • New: Add test for default value for get_bg_color()
    • Change: Test that JS script is both enqueued and registered

Full changelog is available in CHANGELOG.md.