From 15601cfd21bee30b5a230edde5adce3eeafaac99 Mon Sep 17 00:00:00 2001 From: Jb Date: Fri, 8 May 2020 01:12:23 +0200 Subject: [PATCH 1/2] Add help tabs on update-core, plugins, and themes admin screens --- functions.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/functions.php b/functions.php index 056daca..23e8b6d 100755 --- a/functions.php +++ b/functions.php @@ -1353,3 +1353,56 @@ function wp_autoupdates_toggle_auto_updates() { wp_send_json_success(); } add_action( 'wp_ajax_toggle_auto_updates', 'wp_autoupdates_toggle_auto_updates' ); + +/** + * Set up auto-updates help tabs. + */ +function wp_autoupdates_help_tab_update_core() { + $screen = get_current_screen(); + + if ( 'update-core' === $screen->id || 'update-core-network' === $screen->id ) { + $help_tab_content = '

' . __( 'Plugins and Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates schedule depends on WordPress planned tasks.' ) . '

'; + $help_tab_content .= '

' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '

'; + $help_tab_content .= '

' . sprintf( + __( 'For more information: Documentation about auto-updates', 'wp-autoupdates' ), + 'https://wordpress.org/support/article/auto-updates/' + ) . '

'; + $screen->add_help_tab( array( + 'id' => 'auto-updates', + 'title' => __( 'Auto-updates', 'wp-autoupdates' ), + 'content' => $help_tab_content, + 'priority' => 11, + ) ); + } + + if ( 'plugins' === $screen->id || 'plugins-network' === $screen->id ) { + $help_tab_content = '

' . __( 'Auto-updates can be enabled and disabled on a plugin by plugin basis. Plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates schedule depends on WordPress planned tasks.' ) . '

'; + $help_tab_content .= '

' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '

'; + $help_tab_content .= '

' . sprintf( + __( 'For more information: Documentation about auto-updates', 'wp-autoupdates' ), + 'https://wordpress.org/support/article/auto-updates/' + ) . '

'; + $screen->add_help_tab( array( + 'id' => 'auto-updates', + 'title' => __( 'Auto-updates', 'wp-autoupdates' ), + 'content' => $help_tab_content, + 'priority' => 11, + ) ); + } + + if ( 'themes' === $screen->id || 'themes-network' === $screen->id ) { + $help_tab_content = '

' . __( 'Auto-updates can be enabled and disabled on a theme by theme basis. Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates schedule depends on WordPress planned tasks.' ) . '

'; + $help_tab_content .= '

' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '

'; + $help_tab_content .= '

' . sprintf( + __( 'For more information: Documentation about auto-updates', 'wp-autoupdates' ), + 'https://wordpress.org/support/article/auto-updates/' + ) . '

'; + $screen->add_help_tab( array( + 'id' => 'auto-updates', + 'title' => __( 'Auto-updates', 'wp-autoupdates' ), + 'content' => $help_tab_content, + 'priority' => 11, + ) ); + } +} +add_action( 'current_screen', 'wp_autoupdates_help_tab_update_core' ); From 52606ccba01091b84b590469fbe6c7c7abefc860 Mon Sep 17 00:00:00 2001 From: Jb Date: Mon, 11 May 2020 23:27:27 +0200 Subject: [PATCH 2/2] Add few @todo pointers and add check for wp_autoupdates_is_{plugins|themes}_auto_update_enabled --- functions.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 23e8b6d..4c6a66b 100755 --- a/functions.php +++ b/functions.php @@ -1356,13 +1356,16 @@ function wp_autoupdates_toggle_auto_updates() { /** * Set up auto-updates help tabs. + * + * @todo This needs copy review before core merge. */ function wp_autoupdates_help_tab_update_core() { $screen = get_current_screen(); - if ( 'update-core' === $screen->id || 'update-core-network' === $screen->id ) { + if ( ( 'update-core' === $screen->id || 'update-core-network' === $screen->id ) && ( wp_autoupdates_is_plugins_auto_update_enabled() || wp_autoupdates_is_themes_auto_update_enabled() ) ) { $help_tab_content = '

' . __( 'Plugins and Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates schedule depends on WordPress planned tasks.' ) . '

'; $help_tab_content .= '

' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '

'; + // @todo The link below should be moved to the "help sidebar" during core merge process. $help_tab_content .= '

' . sprintf( __( 'For more information: Documentation about auto-updates', 'wp-autoupdates' ), 'https://wordpress.org/support/article/auto-updates/' @@ -1371,13 +1374,15 @@ function wp_autoupdates_help_tab_update_core() { 'id' => 'auto-updates', 'title' => __( 'Auto-updates', 'wp-autoupdates' ), 'content' => $help_tab_content, + // @todo Check if the priority parameter is still necessary during core merge process. 'priority' => 11, ) ); } - if ( 'plugins' === $screen->id || 'plugins-network' === $screen->id ) { + if ( ( 'plugins' === $screen->id || 'plugins-network' === $screen->id ) && wp_autoupdates_is_plugins_auto_update_enabled() ) { $help_tab_content = '

' . __( 'Auto-updates can be enabled and disabled on a plugin by plugin basis. Plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates schedule depends on WordPress planned tasks.' ) . '

'; $help_tab_content .= '

' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '

'; + // @todo The link below should be moved to the "help sidebar" during core merge. $help_tab_content .= '

' . sprintf( __( 'For more information: Documentation about auto-updates', 'wp-autoupdates' ), 'https://wordpress.org/support/article/auto-updates/' @@ -1386,13 +1391,15 @@ function wp_autoupdates_help_tab_update_core() { 'id' => 'auto-updates', 'title' => __( 'Auto-updates', 'wp-autoupdates' ), 'content' => $help_tab_content, + // @todo Check if the priority parameter is still necessary during core merge process. 'priority' => 11, ) ); } - if ( 'themes' === $screen->id || 'themes-network' === $screen->id ) { + if ( ( 'themes' === $screen->id || 'themes-network' === $screen->id ) && wp_autoupdates_is_themes_auto_update_enabled() ) { $help_tab_content = '

' . __( 'Auto-updates can be enabled and disabled on a theme by theme basis. Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates schedule depends on WordPress planned tasks.' ) . '

'; $help_tab_content .= '

' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '

'; + // @todo The link below should be moved to the "help sidebar" during core merge. $help_tab_content .= '

' . sprintf( __( 'For more information: Documentation about auto-updates', 'wp-autoupdates' ), 'https://wordpress.org/support/article/auto-updates/' @@ -1401,6 +1408,7 @@ function wp_autoupdates_help_tab_update_core() { 'id' => 'auto-updates', 'title' => __( 'Auto-updates', 'wp-autoupdates' ), 'content' => $help_tab_content, + // @todo Check if the priority parameter is still necessary during core merge process. 'priority' => 11, ) ); }