• Resolved charlottemcclellan

    (@charlottemcclellan)


    Hi,

    The server my site is hosted on was just upgraded to Ubuntu 22.04 LTS with PHP 8.1 and Force Login is now crashing the site.

    Is this an issue with Force Login?

    Thanks,
    Charlotte

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Kevin Vess

    (@kevinvess)

    Hi, thanks for using Force Login!

    I’m not aware of any issues with Force Login and your server environment.

    Can you elaborate on how exactly it “is now crashing the site” after upgrading your server environment? Is there an error being thrown? Try enabling WP_DEBUG to see if any errors are being thrown.

    If we can pinpoint what part of the Force Login code is causing an issue, I’d be happy to address it.

    Thanks!

    Thread Starter charlottemcclellan

    (@charlottemcclellan)

    Hi,

    With the plugin enabled, when I go to the site I get the message “There has been a critical error on this website”

    If I add /wp-admin to the URL I get the login box and I can login and everything works at this point.

    Enabling WP_DEBUG gives

    Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "my_forcelogin_bypass" not found or invalid function name in /var/www/mcclellan/wp-includes/class-wp-hook.php:309 Stack trace: #0 /var/www/mcclellan/wp-includes/plugin.php(191): WP_Hook->apply_filters() #1 /var/www/mcclellan/wp-content/plugins/wp-force-login/wp-force-login.php(57): apply_filters() #2 /var/www/mcclellan/wp-includes/class-wp-hook.php(307): v_forcelogin() #3 /var/www/mcclellan/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #4 /var/www/mcclellan/wp-includes/plugin.php(476): WP_Hook->do_action() #5 /var/www/mcclellan/wp-includes/template-loader.php(13): do_action() #6 /var/www/mcclellan/wp-blog-header.php(19): require_once('...') #7 /var/www/mcclellan/index.php(17): require('...') #8 {main} thrown in /var/www/mcclellan/wp-includes/class-wp-hook.php on line 309
    
    There has been a critical error on this website.

    Thanks,
    Charlotte

    Plugin Author Kevin Vess

    (@kevinvess)

    Thanks for sending the error message:

    Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function “my_forcelogin_bypass” not found or invalid function name […]

    It appears your site is crashing because of your custom code.

    The site can’t find the function named “my_forcelogin_bypass” which is an example function from the FAQ to showcase how to add exceptions to Force Login. I suspect your site has the following custom code added someplace which isn’t working:

    add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass', 10, 2 );
    

    You need to either remove that line of code from your site, or fix the function name it references to an existing function.

    I recommend you hire a web developer to help you customize this for your site.

    Thanks!

    Thread Starter charlottemcclellan

    (@charlottemcclellan)

    Thanks, that pointed me in the right direction.

    A while back I experimented with bypassing on a couple of IP addresses and then decided I didn’t want that and commented out the function my_forcelogin_bypass function from my functions.php file but forgot to comment out the add_filter line. Interesting that PHP 7.4 didn’t crash but 8.1 did.

    Charlotte

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Ubuntu 22.04 LTS and PHP 8.1’ is closed to new replies.