diff --git a/functions.php b/functions.php index e187142..20df328 100755 --- a/functions.php +++ b/functions.php @@ -1328,6 +1328,7 @@ function wp_autoupdates_themes_bulk_actions_handle( $redirect_to, $doaction, $it } add_filter( 'handle_network_bulk_actions-themes-network', 'wp_autoupdates_themes_bulk_actions_handle', 10, 3 ); + /** * Toggle auto updates via Ajax. */ @@ -1393,3 +1394,64 @@ 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. + * + * @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 ) && ( 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/' + ) . '

'; + $screen->add_help_tab( array( + '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 ) && 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/' + ) . '

'; + $screen->add_help_tab( array( + '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 ) && 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/' + ) . '

'; + $screen->add_help_tab( array( + '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, + ) ); + } +} +add_action( 'current_screen', 'wp_autoupdates_help_tab_update_core' );