Skip to:
Content
Pages
Categories
Search
Top
Bottom

Generic Link to Profile?

  • @kjgbriggs

    Participant

    I am looking to create a generic link to the profile page (for when logged in), but as the URL contains the users name, I cannot create an all-purpose link.

    Is there any way to create a link that changes when the user is logged in, for example:

    If Not Logged In
    Changes to a login link

    If Logged In As John
    Changes to Johns Profile Link

    If Logged In As Jake
    Changes To Jakes Profile Link

    Is something like this possible, it’s kind of an extension of the menu system you already have, but to be placed on a page.

    It may be easier to work out how to have a link that goes to the profile regardless of username.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @henrywright

    Moderator

    You can do that like this:

    <?php if ( is_user_logged_in() ) { ?>
        <a href="<?php echo bp_loggedin_user_domain(); ?>">Profile</a>
    <?php } else { ?>
        <a href="/login">Login</a>
    <?php } ?>

    @kjgbriggs

    Participant

    Not entirely sure where to put this, but tried it in text but didn’t work.

    @henrywright

    Moderator

    It should go into your template file.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Generic Link to Profile?’ is closed to new replies.
Skip to toolbar