• Resolved morality28

    (@morality28)


    Ever since I updated to wp 5.5.1 the wp-members login function doesn’t work properly. After hitting submit to login, I get a white screen. If you hit enter on the url again, then it refreshes and the login works – but this is not an acceptable fix for our users. I tried increasing the php memory limit. Now on the white screen I get an error message “There has been a critical error on your website”

    I have deactivated all other plugins, so I know it is the wp-members that is causing this. I also have the advanced options installed.

    Help please!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    Now on the white screen I get an error message “There has been a critical error on your website”

    That is generally a generic error. But having the actual error would go a long way to figuring out what it actually is. To get that, you need to test in debug mode so you can get any PHP error messages that may be generated, which will give you some insight to the issue.

    The following article describes what WP’s debug mode is and how to enable it:
    https://rocketgeek.com/basics/running-wp-in-debug-mode/

    I also have the advanced options installed.

    Then you should be contacting me through the plugin’s support site. Premium extensions are not supported here on www.ads-software.com. Even if your support/update license is expired, you should contact me there for any questions regarding premium extensions. https://rocketgeek.com/contact/extension-support/

    Turn on debug mode in WP, determine what the error actually is, and let me know here and we’ll go from there.

    Thread Starter morality28

    (@morality28)

    Thank you – I followed all the instructions to turn on debug mode. Now I don’t see any error messages, just the white screen. Again if I hit enter on the url of the white screen, it reloads the login page just fine. The debug log didn’t find anything either. I did find an error log however – it looks like it might be wp-members and my theme not playing nicely together:

    [08-Sep-2020 15:34:01 UTC] PHP Fatal error: Uncaught Error: Call to undefined function wpmem_current_url() in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php:21
    Stack trace:
    #0 /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php(287): my_redirect_to_login(”)
    #1 /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
    #2 /home/alzniag/public_html/volunteers/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
    #3 /home/alzniag/public_html/volunteers/wp-includes/template-loader.php(13): do_action(‘template_redire…’)
    #4 /home/alzniag/public_html/volunteers/wp-blog-header.php(19): require_once(‘/home/alzniag/p…’)
    #5 /home/alzniag/public_html/volunteers/index.php(17): require(‘/home/alzniag/p…’)
    #6 {main}
    thrown in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php on line 21
    [08-Sep-2020 15:35:53 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function my_login_redirect(), 2 passed in /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php on line 287 and exactly 3 expected in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php:5
    Stack trace:
    #0 /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php(287): my_login_redirect(‘https://voluntee…’, 1)
    #1 /home/alzniag/public_html/volunteers/wp-includes/plugin.php(206): WP_Hook->apply_filters(‘https://voluntee…’, Array)
    #2 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members-user.php(119): apply_filters(‘wpmem_login_red…’, ‘https://voluntee…’, 1)
    #3 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members.php(714): WP_Members_User->login()
    #4 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members.php(690): WP_Members->get_regchk(‘login’)
    #5 /home/alzniag/public_html/volunteers/wp-inclu in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php on line 5
    [08-Sep-2020 15:41:20 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function my_login_redirect(), 2 passed in /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php on line 287 and exactly 3 expected in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php:5
    Stack trace:
    #0 /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php(287): my_login_redirect(‘https://voluntee…’, 1)
    #1 /home/alzniag/public_html/volunteers/wp-includes/plugin.php(206): WP_Hook->apply_filters(‘https://voluntee…’, Array)
    #2 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members-user.php(119): apply_filters(‘wpmem_login_red…’, ‘https://voluntee…’, 1)
    #3 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members.php(714): WP_Members_User->login()
    #4 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members.php(690): WP_Members->get_regchk(‘login’)
    #5 /home/alzniag/public_html/volunteers/wp-inclu in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php on line 5
    [08-Sep-2020 15:47:26 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function my_login_redirect(), 2 passed in /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php on line 287 and exactly 3 expected in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php:5
    Stack trace:
    #0 /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php(287): my_login_redirect(‘/profile/’, 284)
    #1 /home/alzniag/public_html/volunteers/wp-includes/plugin.php(206): WP_Hook->apply_filters(‘/profile/’, Array)
    #2 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members-user.php(119): apply_filters(‘wpmem_login_red…’, ‘/profile/’, 284)
    #3 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members.php(714): WP_Members_User->login()
    #4 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members.php(690): WP_Members->get_regchk(‘login’)
    #5 /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php(2 in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php on line 5
    [08-Sep-2020 15:50:27 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function my_login_redirect(), 2 passed in /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php on line 287 and exactly 3 expected in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php:5
    Stack trace:
    #0 /home/alzniag/public_html/volunteers/wp-includes/class-wp-hook.php(287): my_login_redirect(‘https://voluntee…’, 1)
    #1 /home/alzniag/public_html/volunteers/wp-includes/plugin.php(206): WP_Hook->apply_filters(‘https://voluntee…’, Array)
    #2 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members-user.php(119): apply_filters(‘wpmem_login_red…’, ‘https://voluntee…’, 1)
    #3 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members.php(714): WP_Members_User->login()
    #4 /home/alzniag/public_html/volunteers/wp-content/plugins/wp-members/includes/class-wp-members.php(690): WP_Members->get_regchk(‘login’)
    #5 /home/alzniag/public_html/volunteers/wp-inclu in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php on line 5

    Plugin Author Chad Butler

    (@cbutlerjr)

    it looks like it might be wp-members and my theme not playing nicely together:

    Actually, what this appears to be are issues with some custom functions that you have placed in your theme’s functions.php file.

    [08-Sep-2020 15:34:01 UTC] PHP Fatal error: Uncaught Error: Call to undefined function wpmem_current_url() in /home/alzniag/public_html/volunteers/wp-content/themes/dt-the7-child/functions.php:21

    This error is telling you that you are calling the function wpmem_current_url(), but it is undefined where you are using it (your theme’s functions.php file, line 21).

    Depending on how you’re using it, either you’re calling it to early, or this error is the result of the specific code you’re running it from being triggered if the plugin was deactivated.

    The other problem you have is:
    PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function my_login_redirect(), 2 passed...

    In your functions.php file, line 5, you have a custom function my_login_redirect(). Your custom function is asking for 3 required arguments. You’re only passing 2, hence the error. Because again here I do not know the context, but making a guess, you’re hooking this to the wpmem_login_redirect filter? If so, that hook only passes 2 arguments. If your custom function is looking for 3 arguments, you’re adding something that doesn’t exist.

    Thread Starter morality28

    (@morality28)

    I must admit I don’t know much about this stuff so I really appreciate your help. I haven’t changed anything in functions.php and it used to work fine. Here is the code I’ve added. I’m not sure if I found it in your FAQ or not…

    add_filter( ‘wpmem_login_redirect’, ‘my_login_redirect’, 10, 3 );

    function my_login_redirect( $redirect_to, $request, $user ) {
    //is there a user to check?
    if (isset($user->roles) && is_array($user->roles)) {
    //check for subscribers
    if (in_array(‘subscriber’, $user->roles)) {
    // redirect them to another URL
    $redirect_to = site_url( ‘/psw-training/’ );
    }
    }

    return $redirect_to;
    }

    add_action( ‘template_redirect’, ‘my_redirect_to_login’ );
    function my_redirect_to_login() {
    if ( ! is_user_logged_in() && wpmem_current_url() == site_url( ‘/staff/’ ) ) {
    wpmem_redirect_to_login();
    }
    return;
    }

    add_action( ‘template_redirect’, ‘my_redirect_to_login’ );
    function my_redirect_to_login2() {
    if ( ! is_user_logged_in() && wpmem_current_url() == site_url( ‘/calendar/’ ) ) {
    wpmem_redirect_to_login();
    }
    return;
    }

    add_action( ‘template_redirect’, ‘my_redirect_to_login’ );
    function my_redirect_to_login3() {
    if ( ! is_user_logged_in() && wpmem_current_url() == site_url( ‘/category/dementia-training/’ ) ) {
    wpmem_redirect_to_login();
    }
    return;
    }

    Plugin Author Chad Butler

    (@cbutlerjr)

    The error you got from wpmem_current_url() being undefined probably happened when you had the plugin deactivated. Those look fine.

    Your login redirect function however, is a major problem. What you have there wouldn’t have come from me because the arguments in no way match the actual hook. You mentioned that it worked before, but with what you have posted that’s not possible – it would have thrown the same errors.

    The problem looks like you’ve interchanged login_redirect with wpmem_login_redirect. But those are two completely different hooks – the first is a WP filter, and the other is part of WP-Members. Both are used by WP-Members in the login function, and this is for compatibility reasons, but you can’t simply interchange them because they are separate and they pass separate (albeit similar) arguments.

    I suspect what’s happened here is that you found something on the internet that was a login redirect snippet for WP’s login (login_redirect) and you changed the hook name, which you can’t do without adjusting for the documented arguments used by wpmem_login_redirect.

    Rather than rewrite your code for you, you can probably change the hook name from wpmem_login_redirect to login_redirect and I think you’ll be fine. The function arguments look like they are from login_redirect.

    • This reply was modified 4 years, 2 months ago by Chad Butler.
    Thread Starter morality28

    (@morality28)

    Thank you so much Chad – changing to login_redirect worked perfectly!

    I believe I had added that code to redirect a specific group of users (subscribers) to a different page on login than everyone else.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘White screen of death on login’ is closed to new replies.