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.

About: Alex Robertson

Sorry, I've not written a description yet. I'll get to it soon!


Topics I'm Subscribed To

Viewing 3 topics - 1 through 3 (of 3 total)
Topic Count Last Reply
%%current_user_login%% Menu Button

By:  Alex Robertson in: Community Forum

voices: 2
replies: 3

4 years, 6 months ago  Andy Ogden

Addtional Support

By:  Alex Robertson in: Community Forum

voices: 2
replies: 3

4 years, 7 months ago  Alex Robertson

Viewing 3 topics - 1 through 3 (of 3 total)

Topics I've Started

Viewing 3 topics - 1 through 3 (of 3 total)
Topic Count Last Reply
%%current_user_login%% Menu Button

By:  Alex Robertson in: Community Forum

voices: 2
replies: 3

4 years, 6 months ago  Andy Ogden

Addtional Support

By:  Alex Robertson in: Community Forum

voices: 2
replies: 3

4 years, 7 months ago  Alex Robertson

Viewing 3 topics - 1 through 3 (of 3 total)

My Latest Replies (From Various Topics)

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Monday May 14th, 2012 at 4:42 am #13380

I have now solved this issue. – Please close.

Posted: Monday May 14th, 2012 at 4:42 am #13379

I have now solved this issue. – Please close.

Posted: Thursday May 10th, 2012 at 10:30 am #13148

Hi Eduan,

I have emailed you.

Many Thanks

Posted: Thursday May 3rd, 2012 at 7:38 am #12453

Hi All,

I now have the following code

<a href="<?php echo (defined('S2MEMBER_CURRENT_USER_LOGIN') ? S2MEMBER_CURRENT_USER_LOGIN : post_name);?>/">Client Area</a>

But it’s still not redirecting the user if they don’t have a page created?

Any help would be great!

Posted: Monday Apr 30th, 2012 at 5:27 pm #12233

UPDATE:

I have managed to create a hyperlink which takes the current logged in users username and redirects them to their page if created.

<a href="?php echo S2MEMBER_CURRENT_USER_LOGIN; ?>/">Client Area</a>

My next question is:

How can i wrap this in an if statement to say that if the username does not = a page name then redirect them to the home page?

Posted: Friday Apr 20th, 2012 at 2:49 pm #11413

I pasted the following into functions.php just before the closing ?> tag but when i log in as a user that i have not created a page for its stil trying to take them to a page called the same as there username?

Any help would be great?

add_action('ws_plugin__s2member_during_login_redirect','my_login_function');

function my_login_function(){
	//Check to see if there is a page with that title in the system.
	$sql = "SELECT ID FROM wp_posts WHERE post_title = '".S2MEMBER_CURRENT_USER_LOGIN."' AND post_status = 'publish' AND post_type = 'page' LIMIT 1";
	$count = mysql_num_rows(mysql_query($sql));
	
	if($count == 1){
		wp_redirect(site_url(S2MEMBER_CURRENT_USER_LOGIN));
	}
	else {
		wp_redirect(site_url('blog/home'));
	}
}
Posted: Friday Apr 20th, 2012 at 3:56 am #11335

Thanks David,

I will try the below code later. Hopefully i should just be able to amend wp_redirect(site_url(‘trial/profile’)); to my home page link. :)

<?php
add_action('ws_plugin__s2member_during_login_redirect','my_login_function');

function my_login_function(){
	//Check to see if there is a page with that title in the system.
	$sql = "SELECT ID FROM wp_posts WHERE post_title = '".S2MEMBER_CURRENT_USER_LOGIN."' AND post_status = 'publish' AND post_type = 'page' LIMIT 1";
	$count = mysql_num_rows(mysql_query($sql));
	
	if($count == 1){
		wp_redirect(site_url(S2MEMBER_CURRENT_USER_LOGIN));
	}
	else {
		wp_redirect(site_url('trial/profile'));
	}
}

?>

Would it be best to setup a child theme to insert this code? also where would i paste it? somewhere in the header file?

Many Thanks,

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

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.