-
Notifications
You must be signed in to change notification settings - Fork 201
Description
I am using redux framework in my custom plugin, I used TGM to include redux in my plugin, when I upload redux plugin, the redux object become unaccessible by my custom plugin until I deactivate my plugin and re-activate it, here is the TGM config :
`
$this->plugins = [
[
'name' => 'Redux Framework',
'slug' => 'redux-framework',
'required' => true,
'force_activation' => true,
],
];
$this->config = [
'id' => 'plugin-notice',
'default_path' => '',
'menu' => 'tgmpa-install-plugins',
'parent_slug' => 'plugins.php',
'capability' => 'manage_options',
'has_notices' => true,
'dismissable' => false,
'dismiss_msg' => false,
'is_automatic' => true];
tgmpa( $this->plugins, $this->config );
`
TGM does only give notification if required plugin is missing, but it does not stop the execution of the custom code, which will break the website if redux is not active or any other plugin, here is a function I use to check if all the required plugins are active ?
`
public function check_required_plugins_active(){
$plugins_slug = array_column($this->plugins,'slug');
$plugins_path = [];
foreach (get_plugins() as $plugin_file => $plugin_data) {
// Extract the folder name from the plugin file path
$plugin_path_parts = explode('/', $plugin_file);
if (isset($plugin_path_parts[0]) && in_array($plugin_path_parts[0], $plugins_slug) ) {
$plugins_path[]= $plugin_file;
}
}
if( count($plugins_path) != count($plugins_slug))
return false;
if(
in_array(false,
array_map('is_plugin_active',
$plugins_path
)
)
)
return false;
return (class_exists( 'Redux' ) ? true : false );
}`
-
Is the way I am implementing redux in my plugin is wrong, or is it because of how WordPress does load the plugins after plugin activation ? - maybe my custom plugin does run before redux plugin, after redux plugin update and that cause the issue.
-
How can I make sure my custom plugins run after the redux plugin and not before?