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 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion wp-autoupdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Tested up to: 5.4
Author: The WordPress Team
Author URI: https://wordpress.org
Contributors: wordpressdotorg, audrasjb, whodunitagency, pbiron, xkon, karmatosed, mapk
Contributors: wordpressdotorg, audrasjb, whodunitagency, pbiron, xkon, karmatosed, mapk, bookdude13
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don’t directly add your name to the contributors on the plugin header.
You can add your name on the readme.md file and I will take care your name is added to the props list of WordPress 5.5, but the plugin’s list of contributors is updated manually.

Thanks for your comprehension :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, and understood :) I thought I saw something similar in a PR here, but must've been mistaken.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much :)

License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wp-autoupdates
Expand Down 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