This topic has 4 replies, 2 voices, and was last updated 10 years by dojoge.

  • Author
  • #14537
     dojoge
    Participant

    What code snippet do I add to sweet-child/functions.php to redirect registered non-members to the membership levels page?

    #14626
     dojoge
    Participant

    Also, currently, when non-registered users visits the site, they are directed to the membership levels page when they click on any page that requires membership. How can I have them directed to the register page instead?

    #14879
     Abe
    Keymaster

    Hi, Normally if you apply restrictions the default page for the redirect is the levels page.
    To redirect not logged in users to the register page you need to add this code to your sweetdate-child/functions.php

    COPY CODE
    
    // redirect to registration page instead of membership levels page
    add_filter('kleo_pmpro_url_redirect', 'my_custom_redirect');
    
    function my_custom_redirect() {
    	if (is_user_logged_in()) {
    		return pmpro_url("levels");
    	} else {
    		return bp_get_signup_page();
    	}
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #16045
     dojoge
    Participant

    Okay, so anyone not logged in now correctly get redirected to the membership levels page when they try to access member-only content. That’s great!

    When registered non-members try to access a page that is for members only, they get a message that says “This content is for members only.” The problem is that the button below that message says “Click here to register” and clicking that button just takes them back to the home page. How can I get that button to take them to the membership levels page?

    #16047
     dojoge
    Participant

    Nevermind. I figured it out.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘How to redirect registered non-members to membership levels page on login’ is closed to new replies.

Log in with your credentials

Forgot your details?