TGMPA / TGM-Plugin-Activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install, update and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference bundled plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
http://tgmpluginactivation.com/
GNU General Public License v2.0
1.76k stars 429 forks source link

Plugin install button doesn't fire in thickbox modal #649

Open NateWr opened 7 years ago

NateWr commented 7 years ago

On the TGMPA page to install recommended/required plugins, clicking on a plugin will open a thickbox modal with an install button. Clicking the install button doesn't seem to have any effect.

The similar modal from the core plugins screen does work. And I feel like this was working in the past so it may be a recent change introduced in core.

I was able to track down one symptom which may be the source of the issue. The /wp-admin/js/plugin-install.js file reacts to an thickbox:iframe:loaded event fired when the thickbox is loaded:

https://github.com/WordPress/WordPress/blob/master/wp-admin/js/plugin-install.js#L60

This event seems to be getting caught on the core plugin installation screens, but not on TGMPA. I just chucked a console.log('event fired'); in there to test.

So that seems to be an issue. But it leaves me a bit confused, because the button is a link with a proper href attribute that should work directly without requiring any JavaScript. :man_shrugging:

jrfnl commented 7 years ago

@NateWr Thanks for reporting this. If I remember correctly, I've seen issues with this before in the past, but those generally turned out to be caused by a theme/plugin.

NateWr commented 7 years ago

Hi @jrfnl,

WP 4.7.3. It's a theme I've developed. I'm happy to try with a standard theme. Do you have a standard base theme that I can use for testing? Or should I just whip up a child theme of twentyseventeen with the tgmpa integrated?

jrfnl commented 7 years ago

should I just whip up a child theme of twentyseventeen with the tgmpa integrated?

Either that or drop it in must-use plugins with a mini-setup.

jrfnl commented 7 years ago

OK, finally had some time to properly test this and I can consistently reproduce this issue on WP 4.6 and higher.

Also tested this on WP 4.5 and 4.4 and the install does seem to work there, though it doesn't use the TGMPA installation screen, but the WP native on, so the "Return to plugin install" page link at the end of the page take people to the WP plugin install page, not the TGMPA one. Different issue, but not the way it was intended either.

The issue may well be related to the Shiny updates introduction in WP 4.6 - #580. Needs in-depth investigation to see what can be done.