[wp-trac] [WordPress Trac] #52191: Minor core code change to improve update notifications on WordPress MultiSite sub blogs.
WordPress Trac
noreply at wordpress.org
Tue Dec 29 21:56:17 UTC 2020
#52191: Minor core code change to improve update notifications on WordPress
MultiSite sub blogs.
-------------------------------------------------+-------------------------
Reporter: DuisterDenHaag | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Plugins | Version: 5.6
Severity: minor | Keywords:
Focuses: ui, administration, multisite, |
coding-standards |
-------------------------------------------------+-------------------------
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: [https://wisdomplugin.com/add-inline-plugin-update-message/ 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 [https://github.com/YahnisElsts
/plugin-update-checker 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52191>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list