From c2cd777fecf97dd677f18ff3b7f54aaa379434af Mon Sep 17 00:00:00 2001 From: Kaspars Dambis Date: Tue, 17 Feb 2026 10:59:07 +0200 Subject: [PATCH 01/19] Specify the return types --- class-two-factor-core.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/class-two-factor-core.php b/class-two-factor-core.php index 7752abc5..34d64cc1 100644 --- a/class-two-factor-core.php +++ b/class-two-factor-core.php @@ -568,7 +568,8 @@ public static function fetch_user( $user = null ) { * @see Two_Factor_Core::get_available_providers_for_user() * * @param int|WP_User $user Optional. User ID, or WP_User object of the the user. Defaults to current user. - * @return array + * + * @return Two_Factor_Provider[] List of provider instances indexed by provider key. */ public static function get_enabled_providers_for_user( $user = null ) { $user = self::fetch_user( $user ); @@ -602,7 +603,7 @@ public static function get_enabled_providers_for_user( $user = null ) { * @see Two_Factor_Core::get_enabled_providers_for_user() * * @param int|WP_User $user Optional. User ID, or WP_User object of the the user. Defaults to current user. - * @return array List of provider instances. + * @return Two_Factor_Provider[] List of provider instances indexed by provider key. */ public static function get_available_providers_for_user( $user = null ) { $user = self::fetch_user( $user ); From e547cfc258df6923cc7ab0121c006503dc86daca Mon Sep 17 00:00:00 2001 From: Kaspars Dambis Date: Tue, 17 Feb 2026 11:01:18 +0200 Subject: [PATCH 02/19] Only configured providers should be set to enabled --- class-two-factor-core.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/class-two-factor-core.php b/class-two-factor-core.php index 34d64cc1..657104c4 100644 --- a/class-two-factor-core.php +++ b/class-two-factor-core.php @@ -2043,7 +2043,7 @@ private static function get_recommended_providers( $user ) { */ private static function render_user_providers_form( $user, $providers ) { $primary_provider_key = self::get_primary_provider_key_selected_for_user( $user ); - $enabled_providers = self::get_enabled_providers_for_user( $user ); + $available_providers = self::get_available_providers_for_user( $user ); $recommended_provider_keys = self::get_recommended_providers( $user ); // Move the recommended providers first. @@ -2071,7 +2071,7 @@ private static function render_user_providers_form( $user, $providers ) { get_label() ); ?>