#37943 closed defect (bug) (fixed)
Invalid link to the "Run importer" action while installing importer plugin from a multisite sub-site
Reported by: | joelcj91 | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Import | Keywords: | has-screenshots has-patch commit |
Focuses: | javascript, administration, multisite | Cc: |
Description
In a WordPress multisite installation, when you try to import an XML file, from a sub-site, you will be provided with an invalid link to the "Run importer" page after the installation of the "WordPress Importer" plugin. This bug will not be there if it is not a multisite website or if the "WordPress Importer" plugin is already installed.
Steps to reproduce:
1) Create a Multisite website.
2) Go to one of your sub-sites.
3) Make sure that the "WordPress Importer" plugin is not installed already (https://wordpress.org/plugins/wordpress-importer/).
4) Go to Import section in Tools menu.
5) Click on "Install Now" under WordPress import section.
6) Now the WordPress Importer plugin will be installed though ajax request.
7) After successful installation, "Install Now" link will be replaced with "Run importer" link and also, you will be provided with a message at the top - "Importer installed successfully. Run importer".
8) Expected result is a proper, working link to the importer page., inside the current sub-site. But you can see, since the Multisite plugins are managed from network dashboard, the link returned through the ajax response is invalid, as "/network" is appended in the plugin's link.
9)
a) Expected link : mysubsite1/wp-admin/plugins.php?action=activate&plugin=wordpress-importer%2Fwordpress-importer.php&from=import&_wpnonce=123nonce
b) Current link : mysubsite1/wp-admin/network/plugins.php?action=activate&plugin=wordpress-importer%2Fwordpress-importer.php&from=import&_wpnonce=123nonce
10) This results a 404 error when we click on Run mporter.
Please see the screenshot.
Attachments (4)
Change History (15)
@
8 years ago
Patch to fix this by replacing the link in installImporterSuccess function in updates.js
#2
follow-up:
↓ 3
@
8 years ago
- Milestone changed from Awaiting Review to 4.7
@joelcj91 Welcome to Trac, thanks for a great Trac ticket, all the keywords, component, focuses, versions are perfect, detailed reproducible steps and and patch, boom, thanks :)
#3
in reply to:
↑ 2
@
8 years ago
Thanks @netweb
Replying to netweb:
@joelcj91 Welcome to Trac, thanks for a great Trac ticket, all the keywords, component, focuses, versions are perfect, detailed reproducible steps and and patch, boom, thanks :)
#4
follow-up:
↓ 5
@
8 years ago
- Keywords needs-patch added; has-patch removed
On Multisite, new plugins can only be installed via wp-admin/network/plugin-install.php
, not wp-admin/plugin-install.php
. That's why wp_ajax_install_plugin()
uses network_admin_url()
. Importers are installed on wp-admin/import.php
though, so that assumption breaks.
Replacing the URL in the JavaScript is not a good idea as it only treats the symptom, not the cause.
We could solve this by passing pagenow
in the Ajax request and change the URL depending on that, like we already do with wp_ajax_search_install_plugins()
.
#5
in reply to:
↑ 4
@
8 years ago
Ok. I shall create another patch like you suggested.
Replying to swissspidy:
On Multisite, new plugins can only be installed via
wp-admin/network/plugin-install.php
, notwp-admin/plugin-install.php
. That's whywp_ajax_install_plugin()
usesnetwork_admin_url()
. Importers are installed onwp-admin/import.php
though, so that assumption breaks.
Replacing the URL in the JavaScript is not a good idea as it only treats the symptom, not the cause.
We could solve this by passing
pagenow
in the Ajax request and change the URL depending on that, like we already do withwp_ajax_search_install_plugins()
.
#6
@
8 years ago
- Keywords has-patch added; needs-patch removed
@swissspidy, as per your suggestion, I have changed the url from server side. Please review the new patch.
#8
@
8 years ago
In 37943.diff:
- Fix indentation (tabs instead of spaces)
- Do not activate importer network-wide after shiny install. This matches the behaviour after a page refresh.
Run Importer screen with invalid link