Skip to content

Commit

Permalink
Register modules on plugin activation
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmyta committed Jan 9, 2025
1 parent 13949a6 commit 3f68536
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions projects/plugins/protect/src/class-jetpack-protect.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Jetpack_Protect {
);
const JETPACK_WAF_MODULE_SLUG = 'waf';
const JETPACK_BRUTE_FORCE_PROTECTION_MODULE_SLUG = 'protect';
const JETPACK_ACCOUNT_PROTECTION_MODULE_SLUG = 'account-protection';
const JETPACK_PROTECT_ACTIVATION_OPTION = JETPACK_PROTECT_SLUG . '_activated';

/**
Expand Down Expand Up @@ -277,12 +278,13 @@ public static function do_plugin_activation_activities() {
}

/**
* Activates the waf and brute force protection modules and disables the activation option
* Activates the waf, brute force protection and account protection modules and disables the activation option
*/
public static function activate_modules() {
delete_option( self::JETPACK_PROTECT_ACTIVATION_OPTION );
( new Modules() )->activate( self::JETPACK_WAF_MODULE_SLUG, false, false );
( new Modules() )->activate( self::JETPACK_BRUTE_FORCE_PROTECTION_MODULE_SLUG, false, false );
( new Modules() )->activate( self::JETPACK_ACCOUNT_PROTECTION_MODULE_SLUG, false, false );
}

/**
Expand Down Expand Up @@ -340,7 +342,7 @@ public function admin_bar( $wp_admin_bar ) {
* @return array
*/
public function protect_filter_available_modules( $modules ) {
return array_merge( array( self::JETPACK_WAF_MODULE_SLUG, self::JETPACK_BRUTE_FORCE_PROTECTION_MODULE_SLUG ), $modules );
return array_merge( array( self::JETPACK_WAF_MODULE_SLUG, self::JETPACK_BRUTE_FORCE_PROTECTION_MODULE_SLUG, self::JETPACK_ACCOUNT_PROTECTION_MODULE_SLUG ), $modules );
}

/**
Expand Down

0 comments on commit 3f68536

Please sign in to comment.