Opened 4 years ago
Last modified 3 years 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 (6)
#2
@
4 years 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 suggestedis_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.
#3
@
4 years 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.
#5
in reply to:
↑ 4
;
follow-up:
↓ 6
@
3 years ago
Replying to DuisterDenHaag:
Any news?
Do you think that solution below should be helpful?
In wp_plugin_update_rows() function you should remove condition:
<?php if ( ! current_user_can( 'update_plugins' ) ) { return; }
#6
in reply to:
↑ 5
@
3 years ago
Replying to sebastian.pisula:
Replying to DuisterDenHaag:
Any news?
Do you think that solution below should be helpful?
In wp_plugin_update_rows() function you should remove condition:
<?php if ( ! current_user_can( 'update_plugins' ) ) { return; }
Sorry, but I do not think that removing that line would change anything, because the wp_plugin_update_rows
function still adds the plugin file to the same wp_plugin_update_row
function, which performs the check to hide the complete update notice on all sub blogs for all users.
In WordPress 5.9-alpha-52154 the line containing the if ( is_network_admin() || ! is_multisite() )
check is now on line 465 (in my original post that was line 541), by the way.
Anyone?