This topic has 6 replies, 3 voices, and was last updated 10 years by SQadmin.

  • Author
  • #6818
     adam
    Participant

    When users reach the homepage and are not logged in they can submit the search form or click on a Groups page, but they are restricted since they are not yet members or signed in. This is good.

    However, they get redirected to the Membership Levels page. This is not good because selecting a membership level before registering (being logged in) doesn’t do anything. It’s just an empty step. They will have to select the membership level again after registering.

    How do I get it to instead display the restriction message found under WP-Admin->Memberships->Advanced Settings. This one:
    Message for Logged-out Users: This content is for !!levels!! members only (etc.)

    Do I need to edit this code in functions.php to achieve this?

    COPY CODE
    
    add_action('kleo_pmro_extra_restriction_before_my_profile','kleo_my_custom_restrict');
     
    function kleo_my_custom_restrict()
    {
        //full current url
        $actual_link = kleo_full_url();
        //our request uri
        $uri = str_replace(untrailingslashit(home_url()),"",$actual_link);
     
        //restrict messaging page
        if(preg_match("/^\/".bp_get_members_root_slug()."\/". bp_get_loggedin_user_username()."\/messages\/?/", $uri))
        {
            
            $my_restrictions =  array('message' => array(
                    //2 - restrict certain levels. 0 -restrict none; 1 - restrict all
                    'type' => 2,
                    //levels that you apply the restrictions to
                    'levels' => array(0,1,2,3),
                    'not_member' => 1, 
                    'guest' => 1 
                )
            );
             kleo_check_access('message',$my_restrictions);
        }
    }
    

    Note: I want to keep it so that logged-in non-members (or members with restricted memberships) get taken to Membership Levels when they click on something that requires membership since they can easily change their level from there. It’s just not-logged in users I’d like to change.

    Thanks! (I’ve been trying to figure this out all night!)

    #6821
     moroccanish
    Participant

    i had this orb yoou just go to top of screen memberships/page settings/then change levels page to registration, and thats it

    #6826
     adam
    Participant

    unfortunately, that’s not a good fix. users won’t be able to view or select a membership level in that case. it takes newly activated users back to the registration page instead of selecting a membership. thanks though 🙂

    #6829
     moroccanish
    Participant

    Ah I’ve made my site free till I build a membership base up so I I guess that’s why it works for me

    #6873
     SQadmin
    Keymaster

    You can add a filter to set your register page with this added to sweetdate-child/functions.php:

    COPY CODE
    
    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_signup_page();
    	}
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #6882
     adam
    Participant

    thanks – i have a custom registration page though (mysite.com/registration). so would this be the correct code?:

    COPY CODE
    
    /*PMPro redirect*/
    add_filter('kleo_pmpro_url_redirect', 'my_custom_redirect');
     
    function my_custom_redirect() {
        if (is_user_logged_in()) {
            return pmpro_url("levels");
        } else {
            return ('/registration');
        }
    }
    

    it seems to load slowly.

    #6918
     SQadmin
    Keymaster

    That should be the full url http://yourdomain.com/registration

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?