April 30, 201214 yr Hi, I'm currently using the s2member plugin to allow me to create a client portal where users can log in and visit their own secure unique page. (This uses custom capability and the page must be called the same as their username.) But then i also have people that just log on to view my blog and are not clients. My question is. Can i have a link called "My Page" and have some code which says if page name = username then redirect to their page if not then redirect to home page? Any code help would be great.
April 30, 201214 yr Author 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?
May 3, 201214 yr Author 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!
May 14, 201214 yr Could you post your solution? That way the next bod with the same problem could find this thread useful.
Create an account or sign in to comment