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.75k stars 431 forks source link

A way to only load my plugin if all required ones were found sufficient? #760

Open cliffordp opened 5 years ago

cliffordp commented 5 years ago

I assumed there would have been an action hook like 'tgmpa_all_required_have_passed' and then I can load my own plugin's init() on that action.

Or even just having tgmpa() return true/false.

Thanks for any help.

cliffordp commented 5 years ago

Closest thing is $success = \TGM_Plugin_Activation::get_instance()->is_tgmpa_complete(); but it doesn't work for what I am asking it to do.

jrfnl commented 5 years ago

That is not how TGMPA is supposed to be used. TGMPA is a back-end tool with it's own flow which you can hook into to add your requirements and such.

For your own plugin flow, you should hook into the WP native hooks, not the TGMPA hooks.

Also, as plugin folder names and plugin names can be changed, TGMPA can not necessarily definitively say that the requirements are full-filled, only that there is nothing more for TGMPA to do.

You should generally still do a check for a constant/class/function in the dependency which you want to use to be sure it is available and to avoid white screens of death and such.

cliffordp commented 4 years ago

This looks to be what I was wanting, in case anyone else comes looking: https://github.com/micropackage/requirements