Skip to:

Access bbPress login info from existing site

  • I’ve tried to find the answer to this by reading the forums and my own experimentation, but I’m still having problems. Any information welcome. In summary, the only way I can seem to acess bbPress login info from other pages on my site is to put bbPress at the root of my site, i.e. on the same level as my other scripts.

    I have a PHP/MySQL installation and I would like to integrate bbPress with my own PHP applications. I don’t want the user to have to have two login IDs/passwords – my issue is very similar to User table abstracted in future versions?, only in reverse. That is, I want to use bbPress functions as the primary authentication/registration and have my apps acess the bbPress user info.

    EX: I have a file called, in which I have added the following code:

    if (bb_current_user_can('administrate')) {
    //do some things admins can do

    IF I put the bbPress install at the root of, this all works beautifully, but I want to put the bbPress install in If I do that, altering the code to point to “forums/bb-load.php”, I get the login form, but it doesn’t work: I can type userid and password, and click login, but no login occurs. Furthermore, the login form appears even if a valid user is currently logged in – it doesn’t say “Welcome, UserID”.

    Do I need to do a plug-in? If so, what would it do, in general? Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Are you sure you’re actually logged in? I would argue that you’re not logged in if it comes up with the login form.

    I think this sounds like a cookies issue. Can you add this to your config.php and see if it works?

    $bb->cookiepath = '/';

    If not, check what the properties are for cookies set (just to make sure that’s not the problem).

    Hm. I’m pretty sure I’m actually logged in. Let’s say I’m at the gallery.php page, which is in the root of I type in my valid login id and password. The next thing I see is the front page of my forum ( , which reads “Welcome, kehlers (View your profile)” etc. I can add, post, go to admin section, etc. When I view cookies, I have a bb_user_(hash) and bb_pass_(hash), which seem to have appropriate values. All that to say, I think I’m logged in successfully.

    However, if I go back to gallery.php, I still see the login form, as though nothing has happened. I did try adding $bb->cookiepath = '/'; to my config.php, but it didn’t seem to make a difference. Do I need to restart anything (browser? Apache?) once I’ve added that? I wouldn’t think so, but thought it was worth asking.

    Thanks for your help on this!

    My guess was that the cookies were set for the forum but not for folders higher up, but if that didn’t fix it I don’t know if that’s right.

    Well, your guess was correct! Your tip got me to thinking about cookies – I’m a little rusty on my setcookie() syntax! Anyhow, I decided to install WordPress, even though I don’t need it just now, because if I could get that to integrate across directories, then I could surely do what I’m hoping for with the gallery.php page.

    That helped me to understand the interactions of the cookies and directories and domains. All that to say, I was able to get it to work using the following in config.php:

    $bb_cookiepath = "/";
    $bb_cookiedomain = "" ;

    I believe that if cookie domain is not specified, then it will default to be the root of the directory in which the script is running, i.e., making it unavailable to any other directory, including parent directories. You probably already knew that, but just putting it out there in case someone else has the same issue. ;)

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar