latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Login Welcome page / redirection URL

Home Forums Community Forum Login Welcome page / redirection URL

Tagged: 

This topic contains 10 replies, has 2 voices. Last updated by  David Welch 3 years ago.

Topic Author Topic
Posted: Wednesday Dec 25th, 2013 at 8:32 am #62130
Mike Mazza
Username: msmazza

I’ve reviewed Login Welcome page kb customization along with other forum posts and I’m still slightly confused. I’d like to have 3 different LWP’s. One for free access, Premium access and client portal access. I am using the a special redirection URL with replacement code %%Current user Login%% to achieve client portal access. This means I create a specific user page matching the user login for each client that pays for this level of access. THe problem is all other users get directed to a Page not found 404 error because free and premium access users don’t have a page created with their username. How can I accomodate this type of configuration. Thank you.– Mike

List Of Topic Replies

Viewing 10 replies - 1 through 10 (of 10 total)
Author Replies
Author Replies
Posted: Wednesday Dec 25th, 2013 at 3:53 pm #62131
David Welch
Username: dwbiz05

Are those three access types using the s2member user levels or custom capabilities?

You may need to set up a hook to parse more information about the user and redirect accordingly.

You can do this by creating the following file/directory: wp-content/mu-plugins/s2-hacks.php

<?php
add_action('init','my_login_redirect');
function my_login_redirect(){
	if(isset($_GET['dw_redirect']) && $_GET['dw_redirect'] == 'special'){
		if(current_user_can('access_s2member_level2')){
			//Redirect Client Portal
			wp_redirect('client_page_'.S2MEMBER_CURRENT_USER_ID); //replace 'client_page_' with page slug
		}
		else if(current_user_can('access_s2member_level1')){
			//Redirect for Premium Users
			wp_redirect('premium_page'); //replace 'premium_page' with page slug
		}
		else {
			//Redirect to standard page for free users
			wp_redirect('standard_page'); //replace 'standard_page' with page slug
		}
	}
}
?>

This *should* allow you to specify the redirections.

Set the login url to yoursite.com/?dw_redirect=special

Let me know if that doesn’t work.

Dave

Posted: Wednesday Dec 25th, 2013 at 7:28 pm #62139
Mike Mazza
Username: msmazza

I’m using custom capabilities as detailed in the Client portal tutorial. http://www.s2member.com/videos/716DC24E7E347DC2/

I tried to update using code below:

Was unable to navigate. When tried to get to login page , jmp7.wpengine.com/?dw_redirect=special , received a white screen and if already logged most selections resulted in a white page.

Mike

Posted: Wednesday Dec 25th, 2013 at 8:27 pm #62140
Mike Mazza
Username: msmazza

Took a closer look at suggestion. All members are currently level 0 and I am controlling the Client portal access with Custom capabilities. The clients with Client portal access will have access to info specific to them.

Mike

Posted: Saturday Dec 28th, 2013 at 9:02 am #62197
Mike Mazza
Username: msmazza

Any other thoughts on this. Using custom capabilities and special URL redirection to accomodate members that need a user specific login so we can display user specific data and another login welcome page for members that don’t require user specific data, just a generic login page.

Mike

Posted: Saturday Dec 28th, 2013 at 12:10 pm #62204
David Welch
Username: dwbiz05

Try changing the code I offered to use custom capabilities instead of member levels… something like this:

<?php
add_action('init','my_login_redirect');
function my_login_redirect(){
	if(isset($_GET['dw_redirect']) && $_GET['dw_redirect'] == 'special'){
		if(current_user_can('access_s2member_ccap_client')){ //replace client with your ccap
			//Redirect Client Portal
			wp_redirect('client_page_'.S2MEMBER_CURRENT_USER_ID); //replace 'client_page_' with page slug
		}
		else if(current_user_can('access_s2member_ccap_premium')){ //replace premium with your ccap
			//Redirect for Premium Users
			wp_redirect('premium_page'); //replace 'premium_page' with page slug
		}
		else {
			//Redirect to standard page for free users
			wp_redirect('standard_page'); //replace 'standard_page' with page slug
		}
	}
	
	exit;
}
?>

Dave

Posted: Saturday Dec 28th, 2013 at 3:44 pm #62207
Mike Mazza
Username: msmazza

Hmmm. As soon as I add the s2-hack.php to mu-plugins directory I get a white screen even when just navigating to mysite.com

Mike

Posted: Saturday Dec 28th, 2013 at 4:10 pm #62208
David Welch
Username: dwbiz05

Remove the “exit;” from the code and see if that works. It’s working for me that way.

Dave

Posted: Saturday Dec 28th, 2013 at 10:33 pm #62220
Mike Mazza
Username: msmazza

Turned on error reporting and this is what is displayed

Warning: include() [function.include]: Failed opening ‘/nas/wp/www/cluster-1220/jmp7/wp-content/advanced-cache.php’ for inclusion (include_path=’.:/usr/share/php:/usr/share/pear’) in /nas/wp/www/cluster-1220/jmp7/wp-settings.php on line 65

Any idea what this is about?

Mike

Posted: Sunday Dec 29th, 2013 at 9:37 am #62227
Mike Mazza
Username: msmazza

Dave,

Taking a closer look at the code and I’m assuming one of my replaces is incorrect. Would you mind having a look and see what you think.

Also, Premium and won’t be using ccap but will have a login page specific to all premium users.

Thanks
Mike

Posted: Sunday Dec 29th, 2013 at 4:21 pm #62237
David Welch
Username: dwbiz05

Mike, no problem, contact me via email and I can take a look at it. info {at} itelves.com

Dave

Viewing 10 replies - 1 through 10 (of 10 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.