User Page Redirects (6 posts)

  1. Man2u2uk
    Posted 3 years ago #


    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.

  2. Man2u2uk
    Posted 3 years ago #


    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?

  3. Man2u2uk
    Posted 3 years ago #

    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!

  4. Man2u2uk
    Posted 3 years ago #

    I have now solved this issue. - Please close.

  5. s0206
    Posted 3 years ago #

    Hi Man2u2uk

    Would you mind sharing your solution? I'm trying to achieve the same but not having much luck.


  6. Man2u2uk
    Posted 3 years ago #

    Hi s0206,

    The following posts i made on the S2member forums may help.


    But in the end i paid eduan [at] snapsimpletech [dot] com to complete the work for me.

Topic Closed

This topic has been closed to new replies.

About this Topic