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

[Support request] Initial request to login to view protected content page

Simple Membership Plugin › Forums › Simple Membership Plugin › Initial request to login to view protected content page

  • This topic has 4 replies, 2 voices, and was last updated 8 years, 4 months ago by The Assurer.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • April 19, 2018 at 9:15 pm #14189
    poof99
    Participant

    I have a protected page that when a user lands here there is an automatic prompt page that lets a user know that it is a protected page and you need to log in.
    Can you bypass this prompt and go directly to the login page??

    April 19, 2018 at 10:08 pm #14191
    The Assurer
    Moderator

    Is this what you are looking for?
    https://simple-membership-plugin.com/auto-redirect-non-logged-in-users-protect-whole-site/

    April 19, 2018 at 11:55 pm #14196
    poof99
    Participant

    I think so. I tweaked the code like so:
    /*** 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://test.trustvesta.com/investor-login’ );
    exit;
    }
    }

    BUT the results are that my WordPress login gets broken.
    Do I need to tweak the arry on line 3??

    thank you in advance

    April 20, 2018 at 8:26 am #14200
    poof99
    Participant

    I am looking to auto redirect non logged in users on a specific page, not the whole site and bypass the default prompt “You need to login to view this content. Please Login. Not a Member? Join Us” and go straight to the login area.

    Make sense??

    April 21, 2018 at 3:11 am #14207
    The Assurer
    Moderator

    Because you only want this to happen for a particular page; the best available option is to use Partial or Section Protection, to create 2 different views of the same page.
    https://simple-membership-plugin.com/apply-partial-section-protection/

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