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
Prev Previous commit
Merge branch 'trunk' into add/plugin-action-link
  • Loading branch information
felixarntz committed Mar 2, 2022
commit dd480f58c55187c03033ff2f997a07ff8ce8927f
24 changes: 24 additions & 0 deletions admin/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,27 @@ function perflab_plugin_action_links_add_settings( $links ) {

return $links;
}

/**
* Enables all non-experimental modules on plugin activation.
*
* @since 1.0.0
*/
function perflab_activation_hook() {
// Bail if option is already set with any value.
if ( false !== get_option( PERFLAB_MODULES_SETTING, false ) ) {
return;
}

$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 ] = array( 'enabled' => true );
}
}

update_option( PERFLAB_MODULES_SETTING, $modules_settings );
}
register_activation_hook( PERFLAB_MAIN_FILE, 'perflab_activation_hook' );
You are viewing a condensed version of this merge commit. You can view the full changes here.