Make WordPress Core

Changeset 38704


Ignore:
Timestamp:
10/03/2016 06:41:37 AM (7 years ago)
Author:
swissspidy
Message:

Import: Fix plugin activation link after installing an importer on multisite.

When installing the importer via Ajax, the activation link should be the same as if the page were reloaded.

Props joelcj91 for initial patch.
Fixes #37943.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r38698 r38704  
    36203620
    36213621    $install_status = install_plugin_install_status( $api );
     3622    $pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : '';
     3623
     3624    // If install request is coming from import page, do not return network activation link.
     3625    $plugins_url = ( 'import' === $pagenow ) ? admin_url( 'plugins.php' ) : network_admin_url( 'plugins.php' );
    36223626
    36233627    if ( current_user_can( 'activate_plugins' ) && is_plugin_inactive( $install_status['file'] ) ) {
     
    36263630            'action'   => 'activate',
    36273631            'plugin'   => $install_status['file'],
    3628         ), network_admin_url( 'plugins.php' ) );
    3629     }
    3630 
    3631     if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
     3632        ), $plugins_url );
     3633    }
     3634
     3635    if ( is_multisite() && current_user_can( 'manage_network_plugins' ) && 'import' !== $pagenow ) {
    36323636        $status['activateUrl'] = add_query_arg( array( 'networkwide' => 1 ), $status['activateUrl'] );
    36333637    }
  • trunk/src/wp-admin/js/updates.js

    r38672 r38704  
    18771877            wp.updates.installPlugin( {
    18781878                slug:    $button.data( 'slug' ),
     1879                pagenow: pagenow,
    18791880                success: wp.updates.installImporterSuccess,
    18801881                error:   wp.updates.installImporterError
Note: See TracChangeset for help on using the changeset viewer.