"Welcome to members area" page not restricted

Hey Everyone, while I am new to S2Member, I seem to be having an issue with making my “Welcome to members area” private. I have reviewed with instructions several times. Have added the page ID to level one in page restrictions area. Have opened a new browser (using Chrome as default and testing in Safari), and navigated to what is supposed to be the restricted page. The page remains public, regardless how many times I modify, re-save configurations, etc.

The page is located at: http://www.mixedmediaventures.com/welcome-members-area/

I am setting the ‘welcome page’ up as Level 1 access.

I will not be selling this membership, it is for clients that are already paying me for other services. I will be adding them manually.

Is buddypress a requirement? I see quite a bit about that here?

Just a bit frustrated. Any help is GREATLY appreciated. thank you.

Jack,

buddypress is certainly not a requirement!

Have you created a Membership Options Page?

I have created the ‘Login welcome page’ and the ‘welcome to members area’ page. I’ve not create d the membership options page, as I was simply going to provide the login url to my clients.

Thoughts? And Thank You!

s2Member simply won’t work until you create a Membership Options Page. See “Getting Started.” Without it, there’s nowhere to redirect anyone who does not have access rights.

1 Like

Hmmm. Okay. Thanks. I didn’t want to have to create a Membership Options Page, because the only people that will have access to the portal at all are paying clients we onboard manually. I’ll create the Membership options page, and figure out what content to put on it.

Thanks.

Jack,

I have a suggestion that might work better for you than putting content on the MOP. After you have created the MOP, create a plain text document and call it s2-hacks.php Then put the following code in it:

/* Auto-redirect user on login to page sought */
add_action('template_redirect', function () {
    if (!is_page(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID)) {
        return; // Nothing to do here.
    }
    else if(!empty($_REQUEST["_s2member_vars"]))
        @list($restriction_type, $requirement_type, $requirement_type_value, $seeking_type, $seeking_type_value, $seeking_uri) = explode("..", stripslashes((string)$_REQUEST["_s2member_vars"]));
    if (!empty($seeking_uri)) {
        $URI = base64_decode($seeking_uri);
    }
    if( !is_user_logged_in() && !empty($URI) ) {
        $redirect = home_url('/'); // The home URL as-is.
        $redirect = add_query_arg('login_redirect_uri', urlencode($URI), $redirect);
        wp_redirect($redirect); // Perform the redirection.
        exit;
    }
});

EDIT: you need to put <?php at the very top of this file, otherwise it won’t work. It seems that, when I try to add it here, it doesn’t appear. (Of course, if you already have an s2-hacks.php file, you can just add this code, and you will not need to add <?php )

What this will do is automatically redirect anyone without access credentials to your home page. In other words, although the MOP exists, no-one will ever be redirected to it.

If you want users redirected somewhere other than the home page, replace ('/') with ('/name-of-page/') or, if you want to redirect to the default login page, change it to ('/wp-login.php')

Then save the file and upload it to the mu-plugins folder on your site.

2 Likes