WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 4 months ago

#52191 new enhancement

Show plugin update notifications on Plugins screen on WordPress Multisite sub blogs

Reported by: DuisterDenHaag Owned by:
Milestone: Future Release Priority: normal
Severity: minor Version: 3.1
Component: Plugins Keywords: needs-patch
Focuses: ui, administration, multisite Cc:

Description

The purpose of this request it to make plugin update notification equal for every type of WordPress installation without compromising the current capability checks.

Currently, MultiSite sub blogs do not get an inline plugin update notice in the Plugins Page. They do however get a notification icon in the Admin Menu Bar. This might be confusing for users. On Single Site installs non-admins still see the inline update notice, but without the "Update Now" link. Also, if a third-party plugin is not activated network-wide, the Super Admin is likely to not see the update notice. Installing and updating and deleting plugins on a MultiSite installation can only be sone by a Super Admin in the Network Admin Page.

WordPress plugin developers tend to use workarounds by using the action hooks in_plugin_update_message-{$plugin_file} and after_plugin_row_{$plugin_file} to notify their users, as documented here: Wisdom

Yet, the MultiSite example already shows a flaw. Doing it this way the Network Admin Plugins Page will be cluttered with two inline notices. To prevent this the check if( ! is_network_admin() ) should be added, because WordPress core already shows the default inline update notice in the network admin.

Also, as a developer it always felt, to me personally, that the after_plugin_row action seems to be a non-preferred method, due to the many css classes that need to be included, unlike most hooks and filters.

Changing the output check on line 541 in /wp-admin/includes/update.php would solve that.
Replacing if ( is_network_admin() || ! is_multisite() ) with if ( is_network_admin() || is_blog_admin() ) would show the in inline update notices exactly like on single installs by using the in_plugin_update_message-{$plugin_file} action hook. The rest of the code checks the user permissions and will automatically remove the "Update Now" link for non-admins.

I have tested this change and it seems to work without any safety compromises. It appears to be a simple solution to enhance the user experience and helping developers to be aligned with the WordPress Core.

For my own premium plugins is use the Plugin Update Checker by Yahis Elsts, which works perfectly, except that it uses admin notices to notify the users of an available update on the sub blogs. I seem to remember a topic some months ago to reduce/limit plugin developers from using over-using admin notices. Perhaps this minor core code change would help with that as well.

Change History (4)

#2 @SergeyBiryukov
7 months ago

  • Focuses coding-standards removed
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Summary changed from Minor core code change to improve update notifications on WordPress MultiSite sub blogs. to Show plugin update notifications on Plugins screen on WordPress Multisite sub blogs
  • Version changed from 5.6 to 3.1

Hi there, welcome back to WordPress Trac! Thanks for the ticket.

For reference, the ! is_multisite() part was added in [16037] / #14435. Reading through some comments like comment:10:ticket:14435 or comment:46:ticket:14435, as well as ticket #15129, it looks like the intention was to perform all plugin operations on Multisite from the Network Admin screen.

At a glance, it does seems like displaying plugin update notifications on the regular Plugins screen too in Multisite would bring some consistency, and you're right that there's a ! current_user_can( 'update_plugins' ) check in place to remove the "Update now" link. Plugin installation and removal would still need to be done in Network Admin though.

Some notes on the code:

  • The purpose of the current is_network_admin() && ! is_multisite() check is to display the plugin update notice on the Plugins screen in single site, or on the Network Admin Plugins screen in Multisite. I think the suggested is_network_admin() || is_blog_admin() check is redundant. If the goal is to display the plugin update notice on both the regular Plugins screen and Network Admin Plugins screen in Multisite, we may as well remove the whole conditional.
  • We might want to do the same for themes for consistency, as currently Multisite doesn't show theme updates on the Themes screen either, only in Network Admin.
Last edited 7 months ago by SergeyBiryukov (previous) (diff)

#3 @DuisterDenHaag
5 months ago

Thank you for looking in to this.
Since this is my first ticket submission, I am not quite sure what the current status is and wether or not this request is being taken into consideration.

If the goal is to display the plugin update notice on both the regular Plugins screen and Network Admin Plugins screen in Multisite, we may as well remove the whole conditional.

Yes, that is indeed the goal. The actual technical update should remain in the Network Admin only.
The current initial check only prevents the update notice from appearing in the sub blog Plugins Page.

We might want to do the same for themes for consistency, as currently Multisite doesn't show theme updates on the Themes screen either, only in Network Admin.

Sounds very logical.

Note: See TracTickets for help on using tickets.