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

Required Conditions Fulfilled #638

Closed Aternus closed 7 years ago

Aternus commented 7 years ago

Is there a way to check whether all required plugins have been installed before continuing with the theme code execution?

I would like to halt (gracefully) and show an error message on the front end for users without the required plugins.

jrfnl commented 7 years ago

Duplicate of #484 #485 and #550.

You can use TGM_Plugin_Activation::get_instance()->is_tgmpa_complete(), but as this method is meant for internal use, it will report false if there are plugins which need updates or optional plugins which haven't been installed.

Alternatively - in your case this might be the better option - you can pass your list of required plugins through a foreach() checking each with the WP native is_plugin_active().

Hope this helps.