Membership plugin randomly logging out users?

I have some protected areas on my website. I've configured this two ways.

Some pages are entirely protected using URL Groups. I have one "member" group, and a visitor group. I restrict access to the member pages by setting a negative rules on the Visitor access group.

I have a few pages where anyone can access it, but some content on that page is accessible only to members. This content is protected by using the member-level access group short code within the page.

For both of these groups, I am getting reports of people who visit the member areas and are being logged out. These people are logged in and part of the member access level, so they should be accessing the area fine.

It doesn't seem to be restricted to a certain browser/OS, and I haven't been able to replicate the problem myself, and it's not happening to everyone, however, I'm getting enough reports of it happening that I'm convinced there's an issue somewhere.

Is there something I might have misconfigured to be causing this, or some sort of weird known bug? This only happens when they visit one of the protected areas, I haven't had a single report of them getting logged out on non-protected pages.

Thanks

  • Chris

    I don't have any special rules in .htaccess, besides those set up by Websynthesis with their stock Wordpress/Buddypress install.

    I verified, then repaired the DB, however, verify came back as all OK.

    I am using a caching plugin - W3 Total Cache. Currently v 0.9.2.11. However, within W3 Total Cache, I have "Don't cache pages for logged in users" enabled, so these logged in users shouldn't be hitting caches from W3. My site is also configured using CloudFlare.

  • Marko Miljus

    Hi @Chris,

    It seems that browser lost WP cookie at some point or maybe the auth cookie just expires.

    I am sure it does not have anything with the Membership plugin.

    There are 30 other plugins activated. It would be great if you deactivate one by one and see what happens. Since it's a live site, I assume that would be hard to do :slight_smile:

    alternatively, you may try one of these:

    1.) Since the W3 TC sometimes has issues with the log in / log out, you may put this code into your functions of the theme:

    add_action('wp_logout', 'wpmudev_flush_w3tc_cache');
    function wpmudev_flush_w3tc_cache()
    {
        if (function_exists('w3tc_pgcache_flush')) {
            w3tc_pgcache_flush();
        }
    }

    2.) if it does not solve the issue, it could be cookie timeout issue, so we will try to extend it with this:

    function wpmudev_set_cookie_expiration( $expiration, $user_id, $remember ) {
    return $remember ? $expiration : 60000;
    }
    add_filter( ‘auth_cookie_expiration’, ‘wpmudev_set_cookie_expiration’, 99, 3 );

    3.) if you still experience same thing and have access to you php.ini, set the following:

    session.use_only_cookies = 1;
    session. use_trans_sid = 0;

    4.) if you don't have required access, you may try with this one putting into wp-config.php

    @ini_set("session.use_cookies", 1);
    @ini_set("session.use_cookies", 0);

    Cheers,
    Marko

  • jcnjr

    @Marko Miljus said:

    ...it could be cookie timeout issue, so we will try to extend it with this:

    function wpmudev_set_cookie_expiration( $expiration, $user_id, $remember ) {
    return $remember ? $expiration : 60000;
    }
    add_filter( ‘auth_cookie_expiration’, ‘wpmudev_set_cookie_expiration’, 99, 3 );

    Thanks for this Marko! Quick question: Does that "99" mean this is only effective for user_id 99? Or will it set the expire for all user cookies?

    Perhaps a silly question I know, but I am desperately seeking a fix for a nagging session timeout issue that is causing random and frequent logouts. I tried this suggestion by Sarah Gooding but it hasn't made a difference.

    Also, is your suggestion #4 correct above? It looks different than the php.ini settings you suggest in #3.

    Thanks in advance for your help!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.