Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

Login/Out Anomaly

Simple Membership Plugin › Forums › Simple Membership Plugin › Login/Out Anomaly

Tagged: Immediate logout on login

  • This topic has 21 replies, 5 voices, and was last updated 8 years, 6 months ago by mbrsolution.
Viewing 7 posts - 16 through 22 (of 22 total)
← 1 2
  • Author
    Posts
  • March 22, 2017 at 2:47 am #10551
    admin
    Keymaster

    This can only happen with some kind of a caching issue or a PHP Session issue. You already said that you are not using a caching plugin. Is your hosting provider using caching on their end?

    March 25, 2017 at 5:16 pm #10588
    bobgarrett
    Participant

    They say there is no caching on the server.

    March 27, 2017 at 2:49 am #10601
    admin
    Keymaster

    Then there is likely a conflict with another plugin somewhere. The following test can help you find out which one is conflicting:
    https://simple-membership-plugin.com/forums/topic/test-for-plugin-and-theme-conflict-before-posting-an-issue-or-a-bug/

    I know 100% that the login and logout functionality of this plugin is working fine. I have tested it on a few of my sites (where I am using this plugin).

    You can try a different membership plugin and hopefully the other won’t have the same conflict given the setup of plugins you are using on your site.

    March 30, 2017 at 9:56 am #10635
    bobgarrett
    Participant

    The site now seems to be working correctly. I am not sure whether this is 100% but the problem has not arisen since asking the hosting company about caching!

    October 10, 2017 at 9:06 am #12122
    pdp8user
    Participant

    Many of the issues above relate to the fact that there is a difference between WordPress user sessions and Simple Membership member sessions. Whey you log in to Simple Membership, it logs you into WordPress, and when you log out of Simple Membership, it logs you out of WordPress. But WordPress doesn’t know about Simple Membership sessions, so an automatic logout from WordPress doesn’t log you out of Simple Membership.

    WordPress itself logs users out after a period of time or after the browser is closed. When WordPress logs a user out, Simple Membership doesn’t get notified, so when a member returns to the site, Simple Membership thinks they are logged in but WordPress thinks they are logged out.

    There are plugins that allow you to control the WP behaviour – either to extend the duration of the login or to specify a shorter time (and even to warn a user that they are about to be logged out, like a banking site). But I haven’t seen anything that synchronises WordPress user logins with Simple Membership member logins.

    To get round the problem for myself, I’ve added this small bit of code to my theme’s functions.php file:

    add_action( 'wp_loaded', 'bwm_synchronise_wp_swpm_logins' );
    function bwm_synchronise_wp_swpm_logins( ) {
    	if (!is_user_logged_in()){ /* WP user logged out */
    		if(SwpmMemberUtils::is_member_logged_in()) { /* logged in. log them out. */
    			wp_logout();
    		}
    	}
    }
    November 11, 2017 at 7:31 pm #12436
    jweichel
    Participant

    Since I upgraded to version 3.5.8, any user that attempts to login is immediately logged out. I see in the changelog for 3.5.8 a new function was added:
    Added a new function to logout the user from the swpm system if the corresponding wp user session is logged out.

    I see in the log that the check is made to see if the user is logged out of WP. Since the user is trying to login, he is logged out of WP, so the synchronization check fails and the user is logged out. Here is the line from the simple-membership/log-auth.txt file:
    synchronise_swpm_logout_for_wp_users() – WP user session is logged out for this user. So logging out of the swpm session also.

    How can this work?

    November 11, 2017 at 9:48 pm #12438
    mbrsolution
    Moderator

    @jweichel, I tested the latest version in my testing site and it works for me. Can you carry out the following troubleshooting steps.

    Thank you

  • Author
    Posts
Viewing 7 posts - 16 through 22 (of 22 total)
← 1 2
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy