Skip to content
This repository was archived by the owner on Dec 4, 2019. It is now read-only.

Commit 89b50d6

Browse files
committed
Not hiding plugin anymore if an update is available for the core
1 parent 4283ced commit 89b50d6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

WPlusPlusCore.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ public function actionsAndFilters() {
4747
//Then we can hide the core and make it update with the latest version when this other plugin is updating/
4848
add_action( 'upgrader_process_complete', [ $this, 'WPPBundledUpgrade' ], 10, 2 );
4949
//add_action( 'site_transient_update_plugins', [ $this, 'WPPBundledUpdate' ] );
50-
//add_action( 'pre_current_active_plugins', [ $this, 'maybe_hide_plugin' ] );
51-
//add_filter( 'all_plugins', [ $this, 'multisite_maybe_hide_plugin' ] );
50+
add_action( 'pre_current_active_plugins', [ $this, 'maybe_hide_plugin' ] );
51+
add_filter( 'all_plugins', [ $this, 'multisite_maybe_hide_plugin' ] );
5252
}
5353

5454

5555
public function multisite_maybe_hide_plugin( $plugins ) {
5656
if ( count( self::getSingletons() ) > 1 ) {
57-
unset( $plugins[ $this->getPluginFile() ] );
57+
$updates = get_transient( 'update_plugins' );
58+
if ( ! isset( $updates->response[ $this->getPluginFile() ] ) ) {
59+
unset( $plugins[ $this->getPluginFile() ] );
60+
}
5861
}
5962

6063
return $plugins;
@@ -63,7 +66,10 @@ public function multisite_maybe_hide_plugin( $plugins ) {
6366
public function maybe_hide_plugin() {
6467
global $wp_list_table;
6568
if ( count( self::getSingletons() ) > 1 && isset( $wp_list_table->items[ $this->getPluginFile() ] ) ) {
66-
unset( $wp_list_table->items[ $this->getPluginFile() ] );
69+
$updates = get_transient( 'update_plugins' );
70+
if ( ! isset( $updates->response[ $this->getPluginFile() ] ) ) {
71+
unset( $wp_list_table->items[ $this->getPluginFile() ] );
72+
}
6773
}
6874
}
6975

0 commit comments

Comments
 (0)