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

Commit

Permalink
Merge pull request #43 from bookdude13/iss28_refresh_ui_after_manual_…
Browse files Browse the repository at this point in the history
…update

Remove update time text after manual update
  • Loading branch information
audrasjb authored Mar 14, 2020
2 parents 9cfb8ef + c630af0 commit e18c373
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions wp-autoupdates.php
Original file line number Diff line number Diff line change
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.remove();
});
});';
wp_add_inline_script( 'jquery', $script );
}
}
add_action( 'admin_enqueue_scripts', 'wp_autoupdates_enqueues' );

Expand Down Expand Up @@ -130,12 +144,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

0 comments on commit e18c373

Please sign in to comment.