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 to original page on a site that is fully protected

Simple Membership Plugin › Forums › Simple Membership Plugin › Redirect to original page on a site that is fully protected

Tagged: protected site, redirect

  • This topic has 1 reply, 2 voices, and was last updated 6 years, 2 months ago by mbrsolution.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • January 20, 2020 at 4:42 pm #19645
    garymclaughlin
    Participant

    Hi,
    on the wordpress site I am trying to set up, I have done the following.

    I installed the plugin: Simple Membership After Login Redirection
    Everything was working well when I installed it. When a user reached a password protected page, they would have to click “Login” which brought them to the login prompt screen and when they logged in, it would automatically redirect them back to the original page they had accessed and wanted to read.

    We wanted the whole site to be password protected so that people could not see anything without logging in, so we changed our PHP settings, using this article.
    Auto Redirect Non Logged-in Users (Protect Whole Site): https://simple-membership-plugin.com/auto-redirect-non-logged-in-users-protect-whole-site/

    However, now when a user (who is not logged in) clicks any part of the site (such as an article), they are brought automatically to the login page. But when they login, they are brought to the home page? I would like them to be redirected back to the page they were trying to access in the first place. Is there anything in the code for PHP I have to change?

    /*** Auto redirect a user who isn’t logged into the site ***/
    add_filter( ‘pre_get_posts’, ‘swpm_auto_redirect_non_members’ );
    function swpm_auto_redirect_non_members() {
    if( !SwpmMemberUtils::is_member_logged_in() && !is_page( array( ‘membership-login’, ‘membership-join’ )) ) {
    wp_redirect( ‘http://www.your-domain.com/membership-login’ );
    exit;
    }
    }

    January 21, 2020 at 1:27 am #19651
    mbrsolution
    Moderator

    Hi, I have already replied to your other forum post.
    https://wordpress.org/support/topic/redirect-to-original-page-on-a-site-that-is-fully-protected/#post-12346306

    I am marking this one as resolved.

    Thank you

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • 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