Hello @misatotremor
Thank you very much for using our plugin and for posting this issue.
Would you be able to give us more details so we can understand the context of the issue? For example, when is this warning being triggered? The more information you can share with us the better we can understand the issue.
Looking forward to hearing from you.
This warning is triggered upon login. It happens for users with 2FA enabled and those who don’t have it enabled.
On our sites the options wp_2fa_policy value is a:0:{} therefor the current code tries to access a non-existing array key. I could fix this in my install by changing https://plugins.trac.wordpress.org/browser/wp-2fa/trunk/includes/classes/Admin/User.php#L361 and #L362 from
$settings = SettingsUtils::get_option( WP_2FA_POLICY_SETTINGS_NAME );
if ( ! is_array( $settings ) || 'do-not-enforce' === $settings['enforcement-policy'] ) {
to
if ( 'do-not-enforce' === WP2FA::get_wp2fa_setting( 'enforcement-policy' ) ) {.
-
This reply was modified 3 years, 12 months ago by
misatotremor.
Thank you for the update @misatotremor
We are looking into this and will make sure it is addressed in the next update. In the meantime, if you have any other questions or feedback, please get in touch.
Have a great day and all the best this festive season.
Same issue here:
[… date and time …] PHP Warning: Undefined array key “enforcement-policy” in /home/…../public_html/wp-content/plugins/wp-2fa/includes/classes/Admin/User.php on line 362
Great plugin by the way
Hello @kanetweb and @misatotremor
We have identified and fixed the issue.
We have prepared a version update of the plugin with the fix, which you can install. Please download this version update of WP 2FA and install it.
We have tested it ourselves, however, it would be great if you can also confirm the fix.
Looking forward to hearing from you.
Hello @robert681
Thank you very much for the update! I can confirm this fixes the issue for us.