id : ''; if (!in_array($id, ['plugins', 'profile', 'users', 'toplevel_page_acemedia-login-block-settings'], true) && false === strpos($id, 'acemedia')) { return; } echo '

' . esc_html__('Ace Login Block: passkeys are switched off because this server’s PHP has no OpenSSL extension. Everything else, including email codes, authenticator apps, backup codes and login lockout, keeps working. Ask your host to enable OpenSSL and passkeys will return by themselves.', 'acemedia-login-block') . '

'; } /** * Display 2FA setup notice for users who need to set it up */ public function display_2fa_setup_notice() { $user_id = get_current_user_id(); // Don't show notice if user doesn't need 2FA setup if (!$this->user_needs_2fa_setup($user_id)) { return; } // Show notice template include ACEMEDIA_LOGIN_BLOCK_PATH . 'includes/templates/admin/notices/2fa-setup.php'; } /** * Check if user needs 2FA setup */ private function user_needs_2fa_setup($user_id) { return Two_Factor::user_needs_setup($user_id); } /** * Handle clearing 2FA logs */ public function handle_clear_2fa_logs() { if ( isset($_POST['clear_2fa_logs']) && isset($_POST['clear_2fa_logs_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['clear_2fa_logs_nonce'])), 'clear_2fa_logs') && current_user_can('manage_options') ) { $users = get_users(); foreach ($users as $user) { delete_user_meta($user->ID, '_acemedia_2fa_logs'); } add_settings_error( 'acemedia_login_block_messages', 'logs-cleared', __('All 2FA logs have been cleared.', 'acemedia-login-block'), 'updated' ); } } /** * Add an admin notice */ public function add_notice($message, $type = 'success', $is_dismissible = true) { $class = sprintf('notice notice-%s%s', esc_attr($type), $is_dismissible ? ' is-dismissible' : '' ); printf( '

%2$s

', esc_attr($class), wp_kses_post($message) ); } } // Initialize the admin notices handler new Admin_Notices();