Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Remove update time text after manual update #43

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions wp-autoupdates.php
Expand Up @@ -50,6 +50,20 @@ function wp_autoupdates_enqueues( $hook ) {
$script .= '});';
wp_add_inline_script( 'jquery', $script );
}

// When manually updating a plugin the 'time until next update' text needs to be hidden.
// Doesn't need to be done on the update-core.php page since that page refreshes after an update.
if ( 'plugins.php' === $hook ) {
$script = 'jQuery( document ).ready(function() {
jQuery( ".update-link" ).click( function() {
var plugin = jQuery( this ).closest("tr").data("plugin");
var plugin_row = jQuery( "tr.update[data-plugin=\'" + plugin + "\']" );
var plugin_auto_update_time_text = plugin_row.find("span.plugin-autoupdate-time");
plugin_auto_update_time_text.text("");
});
});';
wp_add_inline_script( 'jquery', $script );
}
}
add_action( 'admin_enqueue_scripts', 'wp_autoupdates_enqueues' );

Expand Down Expand Up @@ -126,12 +140,14 @@ function wp_autoupdates_add_plugins_autoupdates_column_content( $column_name, $p
$next_update_time = wp_next_scheduled( 'wp_version_check' );
$time_to_next_update = human_time_diff( intval( $next_update_time ) );
if ( isset( $plugins_updates->response[$plugin_file] ) ) {
echo '<span class="plugin-autoupdate-time">';
echo sprintf(
/* translators: Time until the next update. */
__( 'Update scheduled in %s', 'wp-autoupdates' ),
$time_to_next_update
);
echo '<br />';
echo '</span>';
}
if ( current_user_can( 'update_plugins', $plugin_file ) ) {
echo sprintf(
Expand Down