• Resolved brandthropologist

    (@brandthropologist)


    Hi,

    I’m working on moving a site that uses WPSM from another host into the hosting platform Pantheon. They use Varnish for caching.

    I’ve worked through most issues but am getting stuck on some issues with the WPSM plugin. It seems that the initial login works but after navigating to new pages the logged in user is logged out. I’ve created a temporary site if you’re able to help testing.

    I’ve been linked this by their support: https://docs.pantheon.io/caching-advanced-topics#using-styxkey
    I can’t quite tell if this is a cookie / caching issue or something else related with the hosting platform.

    I can create a user account as well if that would be helpful.

    Any guidance would be very helpful!

    Thanks!

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Thank you for reaching out to us.

    It seems that the initial login works but after navigating to new pages the logged in user is logged out.

    If the user is a member of your site, does he or she have access to the content of the pages in question? In other words does the user have the correct membership levels assigned to him or her to view the content of the protected pages?

    Please also carry out the following troubleshooting steps.

    https://simple-membership-plugin.com/forums/topic/test-for-plugin-and-theme-conflict-before-posting-an-issue-or-a-bug/

    Regards.

    Thread Starter brandthropologist

    (@brandthropologist)

    Hi,

    We have not protected any content, and the only plugin installed is Wp Simple Membership, and we are using the default 2024 theme.

    For example, if you login at /membership-login/ and then even just refresh the page it’ll log you out. Again I believe it’s something to do with cookies/caching.

    Happy to answer anymore questions you may have

    Plugin Support mbrsolution

    (@mbrsolution)

    Hi, I have carried out numerous test and I never get logged out when navigating to a different page or post. I even have refreshed the browser and I remain logged in.

    I suspect that something in your server settings is causing this issue. Have you also tested different browsers? Also make sure there are no browser extensions that might interfere with your login.

    Something that you might like to try as well, is to install a fresh copy of our plugin. Sometimes reinstalling a fresh copy of the plugin can fix issues not easily found.

    Kind regards.

    Plugin Author wp.insider

    (@wpinsider-1)

    Hi, this looks to be a caching issue. The following page has info that will be helpful to understand why this issue happens:

    https://simple-membership-plugin.com/understanding-the-impact-of-caching-on-membership-sites/

    Towards the end of the referenced page, there is some information on configuring a caching solution to disable caching when a specific cookie is present.

    Thread Starter brandthropologist

    (@brandthropologist)

    Hi All,

    Thanks for the help! We found that it was related to caching and how Pantheon handles cookies.

    We wrote a patch for it that seems to have helped a lot (at the very least the page protection is working as expected) Including the code we used below for future people using Pantheon’s hosting. We included this code at the end of our child theme’s functions.php. ( No guarantees this will fix all your compatibility problems )

    //[simple membership pantheon patch]
    add_action( 'init', function() {
    if( class_exists( 'SwpmAuth' ) ) {
       $auth = SwpmAuth::get_instance();
        
    if( !$auth->is_logged_in() ) {
            $user = wp_get_current_user();
    
            if( !empty( $user ) && 0 !== $user->ID ) {
                $auth->login_to_swpm_using_wp_user( $user );
            }
        }
    }
    } );
    
    if( 'true' === @$_GET[ 'swpm-logout' ] ) {
    wp_logout();
    }
    
    

    We do seem to be having issues with the form builder add-on.

    Error! Security check failed for membership level identifier validation. The submitted membership level data does not match.

    I’ve found a fair number of folks have fixed the problem by downloading a new copy of the add-on and reinstalling it. But, since we took over the site we’re not sure which paypal address was used to make the purchase, but we do have an active license. Is there a way we could get access to the latest version of form builder add-on so we can try updating to see if that fixes our final issues on Pantheon hosting. We’ll report back for anyone else using Pantheon.

    Plugin Support mbrsolution

    (@mbrsolution)

    I am glad you found a solution to your problem ?? Also, thank you for sharing your solution. I am sure this will help others who are also hosted by Pantheon.

    In regards to premium addons, please use the following contact form. It is not permitted to discuss premium issues in this forum.

    https://simple-membership-plugin.com/premium-addon-support/

    I will mark this thread as resovled.

    Kind regards.

    Thread Starter brandthropologist

    (@brandthropologist)

    Hi, I’m including another update but please feel free to close this thread if it reopens.

    After taking our site live on Pantheon hosting, we found that the renewals page wasn’t working as expected, it would not work for expired users of WP Simple Membership (WPSM.) Turns out that the comparison function to determine what a “system” page was for WPSM was failing because it was exposing the internal server urls (container URLs) that Pantheon hosting uses. There was a filter that we had to modify to always use get_site_url(), which fixed the issue, code below to include in your functions.php :

    /* Pantheon Patch for comparing URLS to not expose internal container URLs to WPSM */
    add_filter( 'swpm_get_current_page_url_filter', 'current_env_url' );

    function current_env_url( $url ) {
    return get_site_url() . $_SERVER['REQUEST_URI'];
    }

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Issues staying logged in when using Pantheon Hosting’ is closed to new replies.