WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#37373 closed defect (bug) (fixed)

Shiny Updates: Plugin details on multisite create plugin-ception

Reported by: Clorith Owned by: swissspidy
Milestone: 4.6 Priority: high
Severity: normal Version: 4.6
Component: Plugins Keywords: has-patch
Focuses: administration, multisite Cc:
PR Number:

Description (last modified by Clorith)

When searching for a plugin on multisite, clicking the More Details link will open the add plugins page instead of the details from .org

This only happens if you use the search, clicking More Details on a plugin that hasn't been shown from a search result provides the expected details page.

The cause appears to be the More Details link on search results isn't checking if you are on a network admin page or not and therefore omits the /network part of the path.

It seems to be caused by self_admin_url and the check for is_network_admin not passing here, I see #22589 was punted, but obviously this is also affecting the new plugin behavior.

Originally report by @ravanh

Attachments (2)

37373.diff (1.4 KB) - added by swissspidy 3 years ago.
37373.1.diff (3.4 KB) - added by ocean90 3 years ago.

Download all attachments as: .zip

Change History (10)

#1 @Clorith
3 years ago

  • Description modified (diff)

#2 @swissspidy
3 years ago

  • Component changed from General to Plugins
  • Owner set to swissspidy
  • Status changed from new to assigned
  • Summary changed from Plugin details on multisite create plugin-ception to Shiny Updates: Plugin details on multisite create plugin-ception

Hey there, thanks for making us aware of this.

Looks like this has been introduced by Shiny Updates, which adds an Ajax search to the "Add Plugins" screen. You'll see that the links work correctly if you refresh the search results page.

Last edited 3 years ago by swissspidy (previous) (diff)

@swissspidy
3 years ago

#3 @swissspidy
3 years ago

  • Keywords has-patch added; needs-patch removed

37373.diff passes the pagenow variable via Ajax so the correct screen can be set in the Ajax handler.

#4 @swissspidy
3 years ago

  • Severity changed from major to normal

#5 @swissspidy
3 years ago

37373.diff needs to use Yoda conditions, otherwise it looks sane IMHO.

No idea why $wp_list_table was globalized before. @obenland do you perhaps know more?

#6 @obenland
3 years ago

I don't. Maybe it was needed at one point and I forgot to remove the reference. If it's not needed, remove it

@ocean90
3 years ago

#7 @ocean90
3 years ago

We need the same for wp_ajax_search_plugins() too, because WP_Plugins_List_Table has different action links in network admin. Because set_current_screen() doesn't set $GLOBALS['hook_suffix'] which is used by _get_list_table() we have to pass the current screen object to the function. Patch updated in 37373.1.diff.

#8 @ocean90
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 38091:

Plugins: Use the correct admin screen when searching for plugins via Ajax.

Both list tables provide different actions based on where they are loaded, regular admin or network admin. Since there is only one Ajax handler for both screens we have to set the current screen before using the list tables.

Props swissspidy, ocean90.
Fixes #37373.

Note: See TracTickets for help on using tickets.