Skip to content

Commit

Permalink
Fix: multisite admin menu and notices
Browse files Browse the repository at this point in the history
As on multisite by default plugins can only be installed from the network admin, it makes more sense showing the TGM page in the network admin and not in the site admin.

On that same note, the admin notices should be shown on the network admin too.

Related TGMPA#228, TGMPA#239
  • Loading branch information
jrfnl committed Jan 13, 2015
1 parent 374285e commit 6dd0532
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ public function init() {

array_multisort( $sorted, SORT_ASC, $this->plugins );

add_action( 'admin_menu', array( $this, 'admin_menu' ) );
$ms_hook = is_multisite() ? 'network_' : '';

add_action( $ms_hook . 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'admin_head', array( $this, 'dismiss' ) );
add_filter( 'install_plugin_complete_actions', array( $this, 'actions' ) );
add_action( 'switch_theme', array( $this, 'flush_plugins_cache' ) );
Expand All @@ -232,7 +234,8 @@ public function init() {
}

if ( $this->has_notices ) {
add_action( 'admin_notices', array( $this, 'notices' ) );
// @todo: add notice for individual sites that the network admin needs to do something ?
add_action( $ms_hook . 'admin_notices', array( $this, 'notices' ) );
add_action( 'admin_init', array( $this, 'admin_init' ), 1 );
add_action( 'admin_enqueue_scripts', array( $this, 'thickbox' ) );
add_action( 'switch_theme', array( $this, 'update_dismiss' ) );
Expand Down

0 comments on commit 6dd0532

Please sign in to comment.