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
You are here: Home

hrc

  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • September 17, 2017 at 12:22 am in reply to: Auto redirect when a user not login #11987
    hrc
    Participant

    So what should I do?

    September 16, 2017 at 10:55 pm in reply to: Auto redirect when a user not login #11984
    hrc
    Participant

    You mean like this?

    add_filter( 'pre_get_posts', 'swpm_auto_redirect_non_members' );
    function swpm_auto_redirect_non_members() {
        if( !is_admin() && !SwpmMemberUtils::is_member_logged_in() && !is_page( array( 'membership-login', 'membership-join' )) ) {
            wp_redirect( 'http://lifestyle-supportguide.com/membership-login/' );
            exit;
        }
    }

    Actually, I did.
    But in my administration tool(under /wp-admin), it created infinity loop with “too many redirect”.

    September 16, 2017 at 8:54 pm in reply to: Auto redirect when a user not login #11982
    hrc
    Participant

    Ah, you’re correct. Actual url is here.
    http://lifestyle-supportguide.com/

    I think it’s plain wprdpress page.

    September 16, 2017 at 7:00 am in reply to: Auto redirect when a user not login #11977
    hrc
    Participant

    mbrsolution, Thanks. Here’s my code.

    add_filter( 'pre_get_posts', 'swpm_auto_redirect_non_members' );
    function swpm_auto_redirect_non_members() {
        if( !is_admin() && !SwpmMemberUtils::is_member_logged_in() && !is_page( array( 'membership-login', 'membership-join' )) ) {
            wp_redirect( 'http://example.com/membership-login/' );
            exit;
        }
    }

    If you are under published page, it’s OK. But if you are in admin page, it doesn’t work correctly.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
Next Page »

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