Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Enable all non-experimental modules on plugin activation
  • Loading branch information
kirtangajjar committed Feb 28, 2022
commit 079c8a24c67655a2ef39e97e7ad6abf8a2c78d5b
20 changes: 20 additions & 0 deletions admin/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,23 @@ function perflab_get_module_data( $module_file ) {

return $module_data;
}

/**
* Enable all non-experimental modules on plugin activation.
*
* @since 1.0.0
*/
function perflab_activation_hook() {
$modules = perflab_get_modules();
$modules_settings = perflab_get_module_settings();

foreach ( $modules as $module_name => $module_data ) {
if ( ! $module_data['experimental'] ) {
$modules_settings[ $module_name ]['enabled'] = true;
}
}

update_option( PERFLAB_MODULES_SETTING, $modules_settings );
}

register_activation_hook( __FILE__, 'perflab_activation_hook' );