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

Add plugin_status query arg to the enable/disable links in the Automatic Updates column. #48

Merged
merged 1 commit into from
Mar 10, 2020
Merged
Changes from all commits
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
5 changes: 3 additions & 2 deletions wp-autoupdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function wp_autoupdates_add_plugins_autoupdates_column_content( $column_name, $p
$plugins = get_plugins();
$plugins_updates = get_site_transient( 'update_plugins' );
$page = isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ? wp_unslash( esc_html( $_GET['paged'] ) ) : '';
$plugin_status = isset( $_GET['plugin_status'] ) && ! empty( $_GET['plugin_status'] ) ? wp_unslash( esc_html( $_GET['plugin_status'] ) ) : '';
if ( wp_autoupdates_is_plugins_auto_update_enabled() ) {
if ( ! isset( $plugins[ $plugin_file ] ) ) {
return;
Expand Down Expand Up @@ -136,7 +137,7 @@ function wp_autoupdates_add_plugins_autoupdates_column_content( $column_name, $p
if ( current_user_can( 'update_plugins', $plugin_file ) ) {
echo sprintf(
'<a href="%s" class="plugin-autoupdate-disable" aria-label="%s">%s</a>',
wp_nonce_url( 'plugins.php?action=autoupdate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;paged=' . $page, 'autoupdate-plugin_' . $plugin_file ),
wp_nonce_url( 'plugins.php?action=autoupdate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;paged=' . $page . '&amp;plugin_status=' . $plugin_status, 'autoupdate-plugin_' . $plugin_file ),
$aria_label,
__( 'Disable', 'wp-autoupdates' )
);
Expand All @@ -154,7 +155,7 @@ function wp_autoupdates_add_plugins_autoupdates_column_content( $column_name, $p
echo '<p class="plugin-autoupdate-disabled">';
echo sprintf(
'<a href="%s" class="edit" aria-label="%s"><span class="dashicons dashicons-update" aria-hidden="true"></span> %s</a>',
wp_nonce_url( 'plugins.php?action=autoupdate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;paged=' . $page, 'autoupdate-plugin_' . $plugin_file ),
wp_nonce_url( 'plugins.php?action=autoupdate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;paged=' . $page . '&amp;plugin_status=' . $plugin_status, 'autoupdate-plugin_' . $plugin_file ),
$aria_label,
__( 'Enable', 'wp-autoupdates' )
);
Expand Down