Search

bbPress Showcase » bbPress Chat

  1. iwi
    User has not uploaded an avatar

    new member
    Joined: Jul '08
    Posts: 2

    offline

    posted here 'cause well you have no other section for support.

    my goal was to create a 'semi-easy' way for someone to click a link to go to their profile or the login page depending on if they were logged in already.

    my site is wordpress + bbpress fully integrated. I achieved this by pointing a link to a new php file I made, including:
    <?php
    if (bb_is_user_logged_in == true) {
    Header ("Location: /forum/profile.php");
    } else {
    Header ("Location: /forum/bb-login.php");
    }
    ?>

    it works except when logged out, then it still tries to send you to profile.php ??

    Posted 3 years ago #
  2. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    It's kinda messy to do it via redirects in the header because the browser may cache that page result.

    It may be why you are experiencing the redirect to profile even when you are logged it (it's in the browser cache).

    If you are giving them a link to click, just make the href part dynamic.

    this is just an example and not correct/tested code:

    <a href="<?php echo (bb_is_user_logged_in()) ? "/forum/profile.php" : "/forum/bb-login.php"; ?>">Profile</a>
    Posted 3 years ago #
  3. iwi
    User has not uploaded an avatar

    new member
    Joined: Jul '08
    Posts: 2

    offline

    works perfectly... thanks

    Posted 3 years ago #

RSS feed for this topic

Post a reply to “universal login/profile link”

You must log in to post.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
47 users online from in the past 30 minutes. 15 bots 32 guests
3,900 views today 8,638 yesterday 16,043 peak. Most at once 47 today 60 yesterday 131 peak. Visited today: qamilon, pandoracam, lvgalliera
2,288 posts in 394 topics over 66 months by 430 of 2,165 members. Latest: qwe12345100, Janvelden, watchessaleus