Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#50663 closed defect (bug) (fixed)

Add filter for the plugin/theme auto-update message in the Info tab of Site health

Reported by: pbiron's profile pbiron Owned by: whyisjake's profile whyisjake
Milestone: 5.5 Priority: normal
Severity: normal Version:
Component: Site Health Keywords: has-patch has-dev-note
Focuses: Cc:

Description

#50052 introduced a new UI for managing auto-updates for plugins/themes.

That UI can be disabled with the (plugins|themes)_auto_update_enabled filters. When the UI is not disabled, additional information about whether auto-updates are enabled/disabled for specific plugins/themes are added in the debug info in the Site Health tool.

#50280 introduced the (theme|plugin)_auto_update_setting_html and theme_auto_update_setting_template filters that allow plugins to control what is presented in the UI for specific plugins/themes (e.g., by displaying a text message that "Auto-updates are not available for this plugin.").

We should introduce equivalent filters so that the debug info auto-update message can similarly be filtered.

Without these additional new filters, the debug message could be incorrect/misleading.

Attachments (4)

50663.diff (4.9 KB) - added by audrasjb 4 years ago.
Add filters to manage plugins and themes auto-updates info on Site Health screen
Capture d’écran 2020-07-21 à 18.41.07.png (58.7 KB) - added by audrasjb 4 years ago.
Active theme screenhot
Capture d’écran 2020-07-21 à 18.41.13.png (72.1 KB) - added by audrasjb 4 years ago.
Inactive themes screenshot
Capture d’écran 2020-07-21 à 18.41.19.png (47.2 KB) - added by audrasjb 4 years ago.
Active and inactive plugins

Download all attachments as: .zip

Change History (16)

#1 @audrasjb
4 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.5

Thanks @pbiron
Let's add this ticket in milestone 5.5 as it is a small and self contained change related to auto-updates feature :)

#2 @davidbaumwald
4 years ago

  • Keywords needs-dev-note added

@audrasjb Is this still on your list for 5.5? Also, I tagged as needs-dev-note for the new filters.

#3 @audrasjb
4 years ago

Yes @davidbaumwald it's on my list for 5.5, my patch is almost ready, just need a quick review before sending.

This ticket was mentioned in Slack in #core by whyisjake. View the logs.


4 years ago

@audrasjb
4 years ago

Add filters to manage plugins and themes auto-updates info on Site Health screen

@audrasjb
4 years ago

Active theme screenhot

@audrasjb
4 years ago

Inactive themes screenshot

@audrasjb
4 years ago

Active and inactive plugins

#5 @audrasjb
4 years ago

  • Keywords has-patch added; needs-patch removed

To test this patch, you can use the following snippet:

<?php
function jba_plugin_auto_update_debug_str( $str, $plugin, $enabled ) {
        if ( in_array( $plugin['Name'], [ 'Hello Dolly', 'Reusable Blocks Extended', 'GDPR Data Request Form' ], true ) ) {
                $str = __( 'Auto-updates are not available for this plugin' );
        }
        return $str;
}
add_filter( 'plugin_auto_update_debug_str', 'jba_plugin_auto_update_debug_str', 10, 3 );

function jba_theme_auto_update_debug_str( $str, $theme, $enabled ) {
        if ( in_array( $theme->name, [ 'Twenty Twenty', 'Twenty Nineteen', 'Twenty Eleven' ], true ) ) {
                $str = __( 'Auto-updates are not available for this theme' );
        }
        return $str;
}
add_filter( 'theme_auto_update_debug_str', 'jba_theme_auto_update_debug_str', 10, 3 );

Of course, don't forget to replace the plugin names :-)

Cheers,
jb

#6 @pbiron
4 years ago

50663.diff LGTM, thanx!

#7 @whyisjake
4 years ago

  • Owner set to whyisjake
  • Resolution set to fixed
  • Status changed from new to closed

In 48546:

Site Health: Add auto-update information to for plugins and themes.

New filters:

  • plugin_auto_update_debug_str
  • theme_auto_update_debug_str

Fixes #50663.
Props pbiron, audrasjb, davidbaumwald.

#8 @SergeyBiryukov
4 years ago

In 48549:

Site Health: Rename the filters added in [48546] for clarity.

See #50663.

#9 @SergeyBiryukov
4 years ago

In 48552:

Site Health: Simplify the logic for displaying whether auto-updates are enabled for plugins and themes.

Remove some extra variables.

Follow-up to [48546], [48549].

See #50663.

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


4 years ago

#11 @SergeyBiryukov
4 years ago

In 48561:

Docs: Correct type for the $theme parameter of theme_auto_update_debug_string filter.

Follow-up to [48546], [48549], [48552].

See #50663.

Note: See TracTickets for help on using tickets.