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

[Resolved] Redirect issues (not what you think :) )

Simple Membership Plugin › Forums › Simple Membership Plugin › Redirect issues (not what you think :) )

Tagged: home, homepage, redirect

  • This topic has 19 replies, 2 voices, and was last updated 6 years, 5 months ago by mbrsolution.
Viewing 15 posts - 1 through 15 (of 20 total)
1 2 →
  • Author
    Posts
  • September 7, 2019 at 3:31 pm #18871
    RobL
    Participant

    Hi,

    I’m having an issue where a user, on a site with Simple Membership installed and working correctly, logs into the WordPress Admin (/wp-admin) page and gets redirected back to the home page. This is *NOT* the classic WordPress issue <a href=”https://www.wpbeginner.com/wp-tutorials/how-to-fix-wordpress-login-page-refreshing-and-redirecting-issue/” rel=”noopener noreferrer” target=”_blank”>as seen here. I know it’s not the classic issue because A) I tried those steps (and others) multiple times without success, B) If I go back to the browser’s address bar and slap /wp-admin back onto the (homepage) URL, I correctly get into the WP admin without redirection, and most importantly, C) I can make the problem go away by disabling the Simple Membership plugin.

    Other things tried:
    1. Turning on debugging – no help. i.e., no errors
    2. Clearing cache – no help
    3. Deleting cookies – no help
    4. Disabling just the Simple Member Login Redirection Addon Plugin – no help

    If the solution is not known off-hand,

      please give me steps I can use to help debug the issue

    .

    Regards,
    Rob

    September 8, 2019 at 3:02 am #18874
    mbrsolution
    Moderator

    Hi,

    Can you first carry out a plugin/theme conflict test.

    Let me know how you go.

    Regards

    September 8, 2019 at 2:52 pm #18879
    RobL
    Participant

    Hi,

    I was trying (and obviously failing 🙂 ) to be clear that I’d tried all those tests previously. The only way to make the issue go away is to deactivate the main Simple Membership plugin.

    I do, however, have an important bit of information I didn’t mention previously. This issue only happens with users who are both WP users and Simple Membership members. I created a new WP user with editing privileges (Editor) and that user can login to /wp-admin with no issues. The instant I add that user to Simple Membership, the redirect issue occurs.

    I’m a well-seasoned software guy and am happy to debug if you point me in the right direction.

    Regards,
    Rob

    September 8, 2019 at 9:46 pm #18881
    mbrsolution
    Moderator

    Hi,

    I created a new WP user with editing privileges (Editor) and that user can login to /wp-admin with no issues. The instant I add that user to Simple Membership, the redirect issue occurs.

    How are you importing the user into the Members area in Simple Membership plugin?

    Regards

    September 9, 2019 at 1:01 am #18883
    RobL
    Participant

    Hi,

    To create a user & Simple Membership member I’ve used the following methods:
    A. Using Simple Membership WP User Import to import a current WordPress user
    and
    B. Creating a user directly in Simple Membership Add Member feature

    The last example of creating the new WP user that I mentioned, I created the user in WP’s Users are and then used the Simple Membership WP User Import.

    Another bit of data – I checked some other sites I work with and have Simple Membership installed and the issue does not exist.

    I’m as sure as I can be at this point that something in WP_USERS, WP_USERMETA or WP_OPTIONS got “corrupted”, though I’m not sure what to look for.

    Regards,
    Rob

    September 9, 2019 at 1:10 am #18884
    mbrsolution
    Moderator

    Hi, yes I agree that something has become corrupted in your install.

    Lets try something different. Disable and delete the plugin. Then install a fresh new copy of Simple Membership plugin. Then carry out a test.

    Just to be on the safe side, create a backup of your site just in case something goes wrong. This is merely a precaution.

    Let me know how you go.

    Kind regards

    September 9, 2019 at 1:47 am #18885
    RobL
    Participant

    Hi,

    OK, I’ll try that some time this week and get back to you.

    Regards,
    Rob

    October 13, 2019 at 4:09 pm #19090
    RobL
    Participant

    Hi,

    Sorry for the long delay. I tried deleting the plugin and reinstalling and the behavior is still the same. And now, as an added bonus, it’s happening on two of my websites.

    Issue summary (since it’s been a while)
    —————————————
    With Simple WP Membership installed, if I try to access <mydomain>/wp-admin/ the FIRST time, the user is instead, redirected to <mydomain> (home page). If I then go to the location bar, put /wp-admin on the end of it and hit enter, the user is correctly directed to the WP admin dashboard.

    Relevant Facts
    ————–
    1. I have the “Simple Membership After Login Redirection” plugin installed. And it is set up for ”
    Enable Redirect to Last Page”.
    2. If I disable only the Simple Membership plugin, the problem doesn’t occur

    Things tried
    ————
    Everything above that you suggested

    I’m asking at this point to simply direct me to the code that could or does redirect user logins so I can debug it.

    Regards,
    Rob

    October 14, 2019 at 12:58 am #19091
    mbrsolution
    Moderator

    Hi Rob,

    With Simple WP Membership installed, if I try to access <mydomain>/wp-admin/ the FIRST time, the user is instead, redirected to <mydomain> (home page). If I then go to the location bar, put /wp-admin on the end of it and hit enter, the user is correctly directed to the WP admin dashboard.

    Our plugin only controls the redirection for members when they log in via the membership form, not the WordPress form /wp-login/.

    Relevant Facts
    ————–
    1. I have the “Simple Membership After Login Redirection” plugin installed. And it is set up for ”
    Enable Redirect to Last Page”.

    What happens when someone logs in via SMP login form? Are they redirected to the last page?

    2. If I disable only the Simple Membership plugin, the problem doesn’t occur

    I think you might be misunderstanding how the login redirect works. Please read my comment above.

    Let me know if the above helps you and also makes sense to you.

    Kind regards

    October 17, 2019 at 12:42 am #19127
    RobL
    Participant

    Hi,

    Actually, I do understand what the login redirect is supposed to do and that’s why I’m completely puzzled as to what’s happening.

    If someone goes to a page protected by Simple Membership, he is asked to login via the Simple Membership login and when he enters the proper credentials he is directed to the page he tried to access. So that is expected and correct.

    However, on two sites now, Simple Membership is somehow affecting the “regular” login of someone accessing /wp-admin after the user is redirected to the wp-login URL. Additionally, I just noted that when a wp-admin user logs out, he is redirected NOT to the /wp-admin/?loggedout=true URL, rather he is redirected to the home page.

    And, to repeat, if I deactivate Simple Membership only, the act of logging in to wp-admin pages word as expected. So, regardless of whether or not I’ve done something horrible (on multiple sites), the two issues are related.

    I know you’re thinking to yourself that it’s not possible, but it’s really happening.

    Regards,
    Rob

    October 17, 2019 at 1:12 am #19128
    RobL
    Participant

    Hi again,

    I just noticed something else related to this issue.

    On site #1 that has this problem, when the admin attempts to login to /wp-admin/ he is redirected to the home page.
    On site #2 that has this problem, when the admin attempts to login to /wp-admin/ he is redirected to a page that’s protected by Simple Membership (yes, really).

    What I noticed is that for site #2, that page is the value I have set for “After Login Redirection Page” in the Simple Membership settings. For site #1, that value is blank. And to be clear, for site #2 (and site #1) I have the Enable Redirect to Last Page turned on, so, in theory, that value in “After Login Redirection Page” should be ignored anyway.

    More info…more crazy stuff.

    Regards,
    Rob

    October 20, 2019 at 3:08 pm #19146
    RobL
    Participant

    I did more debugging and it’s becoming more clear there’s something odd going on here. It would be nice if someone could comment on my situation. I turned on the SWPM debugging for an environment that has no problem and one that does and then I logged into /wp-admin. The log file content is dramatically different.

    Problem environment
    ——————-
    [10/20/2019 2:43 PM] – SUCCESS: wp_authenticate action. Empty username provided. Adding set_current_username hook to catch potential login attempt.
    [10/20/2019 2:43 PM] – SUCCESS: wp_authenticate action. Handling login for username: webmaster
    [10/20/2019 2:43 PM] – SUCCESS: SwpmAuth::login()
    [10/20/2019 2:43 PM] – SUCCESS: Authentication request – Username: webmaster
    [10/20/2019 2:43 PM] – SUCCESS: Authentication successful for username: webmaster. Executing swpm_login action hook.
    [10/20/2019 2:43 PM] – SUCCESS: Trying wp_signon() with username: webmaster
    [10/20/2019 2:43 PM] – SUCCESS: wp_authenticate action. User with username: webmaster is already logged in.
    [10/20/2019 2:43 PM] – SUCCESS: wp_login hook triggered. Username: webmaster
    [10/20/2019 2:43 PM] – SUCCESS: Setting current WP user to: webmaster
    [10/20/2019 2:43 PM] – SUCCESS: Triggering swpm_after_login hook.

    No problem environment
    ———————-
    [10/20/2019 2:45 PM] – SUCCESS: wp_authenticate action. Handling login for username: [user.name]
    [10/20/2019 2:45 PM] – SUCCESS: SwpmAuth::login()
    [10/20/2019 2:45 PM] – SUCCESS: Authentication request – Username: user.name
    [10/20/2019 2:45 PM] – SUCCESS: wp_login hook triggered. Username: user.name

    The comment in the code that throws the “Empty username provided” text to the log file, says, “empty username can mean some plugin trying to login WP user using its own methods.” So I performed a test on the problem environment. I deactivated every single plugin, except the three Simple Membership plugins (main, after login and custom messages) and when I logged in to /wp-admin the problem still happens!

    I went another step further. I hardcoded the username and password in the SWPM code to see if that would work. Unfortunately, even though the log is different the same problem exists. You’ll note that it still is saying “Executing swpm_login action hook.”

    [10/20/2019 3:17 PM] – SUCCESS: wp_authenticate action. Handling login for username: webmaster
    [10/20/2019 3:17 PM] – SUCCESS: SwpmAuth::login()
    [10/20/2019 3:17 PM] – SUCCESS: Authentication request – Username: webmaster
    [10/20/2019 3:17 PM] – SUCCESS: Authentication successful for username: webmaster. Executing swpm_login action hook.
    [10/20/2019 3:17 PM] – SUCCESS: Trying wp_signon() with username: webmaster
    [10/20/2019 3:17 PM] – SUCCESS: wp_authenticate action. User with username: webmaster is already logged in.
    [10/20/2019 3:17 PM] – SUCCESS: wp_login hook triggered. Username: webmaster
    [10/20/2019 3:17 PM] – SUCCESS: Setting current WP user to: webmaster
    [10/20/2019 3:17 PM] – SUCCESS: Triggering swpm_after_login hook.

    Please tell me what do at this point.

    Regards,
    Rob

    October 20, 2019 at 3:42 pm #19148
    RobL
    Participant

    After yet further debugging, I realized that there was a flaw in my belief that one environment worked while the other didn’t. The difference is that on the one environment I was logging in to /wp-admin as a WP user who is NOT an SWPM member, thus swpm_after_login hook isn’t called (for reasons I’m not yet clear on) and thus there is no problem. If on the same environment I login as a user who IS an SWPM member, the same bad issue happens.

    Unfortunately, that still leaves me unclear as to how to resolve this issue. I find it hard to believe that I’m the only SPWM consumer to have tried to login to /wp-admin/ as a user who is also an SWPM user.

    October 20, 2019 at 9:00 pm #19149
    mbrsolution
    Moderator

    Hi, unfortunately I am out of ideas on how to troubleshoot your issue. I have submitted a message to the developers to investigate further your problem.

    Thank you

    October 21, 2019 at 11:52 am #19151
    RobL
    Participant

    OK, thanks. Just to be clear, the problem is rather simple and easily reproducible. If I attempt to login to /wp-admin/ with a user who is both a WP User (administrator in this case) and SWPM member, the user is redirected by the SWPM redirection code.

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 20 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