• Resolved filatovdanyl

    (@filatovdanyl)


    Hi, I got a fatal error coming from your plugin:

    Call to undefined function WP2FA\\Authenticator\\login_header() in .../plugins/wp-2fa/includes/classes/Authenticator/class-login.php:813

    This error showed up in wp debug.log each time someone logged in and used 2fa.

    Plugin version is latest at time of writing: 2.3.0.

    I fixed it on my website with some code that I based on your code in login_html() function where you do check if login_header() function exists before calling it and hooked it to your WP_2FA_PREFIX . ‘user_authenticated’ action which fires shortly before this error happens.

    Code I added to my themes functions.php:

    add_action( 'init', 'wyf_2fa_error_fix_init' );
    function wyf_2fa_error_fix_init() {
    	if ( defined( 'WP_2FA_PREFIX' ) ) {
    		add_action( WP_2FA_PREFIX . 'user_authenticated', 'wyf_2fa_error_fix' );
    	}
    }
    function wyf_2fa_error_fix() {
    	if ( ( ( isset( $_REQUEST['interim-login'] ) ) ? filter_var( $_REQUEST['interim-login'], FILTER_VALIDATE_BOOLEAN ) : false ) && ! function_exists( 'login_header' ) && defined( 'WP_2FA_PATH' ) ) {
    		include_once WP_2FA_PATH . 'includes/functions/login-header.php';
    	}
    }

    So pls fix this in your plugin too ??

    • This topic was modified 2 years, 1 month ago by filatovdanyl.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor robertabela

    (@robert681)

    Hello @filatovdanyl

    Thank you for using our plugin.

    I am sorry to read about your issue. Just to confirm, this issue is happening with the interim login only, right?

    Other users have already reported this problem and this is happening because for some reason a function we are using (and which should be loaded at that time) is not found. Something third party, like a theme or another plugin is somehow interfering with this.

    We have a build with a fix, in which we “enforce” the function. Can you please try update 20220923 WP2FA v2.3.0 – undefined function patch and let us know if it works for you?

    You can download it from our plugins patches page.

    Looking forward to hearing from you.

    Thread Starter filatovdanyl

    (@filatovdanyl)

    Hi @robert681

    Installed your patch and removed my fix – works, no errors!

    Just to confirm, this issue is happening with the interim login only, right?

    – yes probably ??

    Plugin Contributor robertabela

    (@robert681)

    I am glad to read that @filatovdanyl

    Should there be anything else, do not hesitate to ask. By the way, please do not forget to spare a minute to rate our plugin and service. These really help us supporting the plugin.

    Thank you and have a great day.

    aryansapaad

    (@aryansapaad)

    Hello @robert681

    When will an official update roll in with this patch in it? I have done the fix for now, but today I got the same issue on a different website again. I guess it will be better if this patch fix comes in the next update of the plugin.

    Plugin Contributor robertabela

    (@robert681)

    Hello @aryansapaad

    Thank you for using the plugin. We have already started working on the next update, and this patch will be included in the update. Even though I can’t give you an ETA of when this update will be available, I am pretty certain it will be ready before the festive season (and hopefully before!).

    Thank you for your support and for using the plugin. Please do not forget to spare a minute to rate our plugin and service. These ratings are really helpful, especially to maintain the free edition of the plugin.

    Have a great day.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Fatal error login_header() undefined – fix’ is closed to new replies.