Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #121 from WordPress/add/help_tabs
Browse files Browse the repository at this point in the history
Add help tabs on update-core, plugins, and themes admin screens
  • Loading branch information
audrasjb authored May 12, 2020
2 parents 696f4e2 + 5f7da32 commit d1d5982
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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 = '<p>' . __( '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.' ) . '</p>';
$help_tab_content .= '<p>' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '</p>';
// @todo The link below should be moved to the "help sidebar" during core merge process.
$help_tab_content .= '<p>' . sprintf(
__( 'For more information: <a href="%s">Documentation about auto-updates</a>', 'wp-autoupdates' ),
'https://wordpress.org/support/article/auto-updates/'
) . '<p>';
$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 = '<p>' . __( '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.' ) . '</p>';
$help_tab_content .= '<p>' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '</p>';
// @todo The link below should be moved to the "help sidebar" during core merge.
$help_tab_content .= '<p>' . sprintf(
__( 'For more information: <a href="%s">Documentation about auto-updates</a>', 'wp-autoupdates' ),
'https://wordpress.org/support/article/auto-updates/'
) . '<p>';
$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 = '<p>' . __( '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.' ) . '</p>';
$help_tab_content .= '<p>' . __( 'Please note: WordPress auto-updates may be overridden by third-parties plugins or custom code.' ) . '</p>';
// @todo The link below should be moved to the "help sidebar" during core merge.
$help_tab_content .= '<p>' . sprintf(
__( 'For more information: <a href="%s">Documentation about auto-updates</a>', 'wp-autoupdates' ),
'https://wordpress.org/support/article/auto-updates/'
) . '<p>';
$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' );

0 comments on commit d1d5982

Please sign in to comment.