Skip to content

Commit

Permalink
Merge ddc1275 into 90ffe25
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Jan 7, 2016
2 parents 90ffe25 + ddc1275 commit dda8314
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion class-tgm-plugin-activation.php
Expand Up @@ -1004,7 +1004,7 @@ protected function activate_single_plugin( $file_path, $slug, $automatic = false
*/
public function notices() {
// Remove nag on the install page / Return early if the nag message has been dismissed or user < author.
if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) {
if ( ( $this->is_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) {
return;
}

Expand Down Expand Up @@ -1603,6 +1603,35 @@ protected function is_tgmpa_page() {
return isset( $_GET['page'] ) && $this->menu === $_GET['page'];
}

/**
* Determine if we're on a WP Core installation/upgrade page.
*
* @since 2.x.x
*
* @return boolean True when on a WP Core installation/upgrade page, false otherwise.
*/
protected function is_core_update_page() {
// Current screen is not always available, most notably on the customizer screen.
if ( ! function_exists( 'get_current_screen' ) ) {
return false;
}

$screen = get_current_screen();

if ( 'update-core' === $screen->base ) {
// Core update screen.
return true;
} elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok.
// Plugins bulk update screen.
return true;
} elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok.
// Individual updates (ajax call).
return true;
}

return false;
}

/**
* Retrieve the URL to the TGMPA Install page.
*
Expand Down

0 comments on commit dda8314

Please sign in to comment.