Skip to:

Site integration automatic login?

  • I have successfully merged bbpress with my website and it works fine sharing user data and logging in/out… very almost.

    When a user first moves to the forum it shows them as not logged in, though if they click a forum link or refresh the page they are then shown as logged in.

    I only modified pluggable.php a little to make the cookie easier to handle and I’ve tried adding a function (below) in index.php and template header. Very crude , checking a cookie is set and calling the login function, but it’s just a test:

    if (isset($_COOKIE[bbpres...]) &&  isset($_COOKIE[IHuser...]) && isset($_COOKIE[IHpass...])){
    $login = decode($_COOKIE[IHuser...]);
    $password = decode($_COOKIE[IHpass...]);
    bb_login($login, $password, $remember = false);

    Really I’m looking for where bbpress first checks to see if a user is logged in and sets headers but so far I’m out of luck. Where do I need to put my function so a user will be shown as logged in as soon as the navigate to the forum?

    P.S. I will build a more solid function so a users password isn’t in a cookie, like I say – just a test!

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’m having the same problem! After integrating, I see how the “test user” I created shows up in both admin consoles. However, whether I login to wordpress or bbpress first, the login does not carry over to the other when navigating, which forces me to login twice. I followed all the steps, which also inlcuded adding the following to the wp-config.php file…

    define(‘COOKIE_DOMAIN’, ‘*******’);

    define(‘COOKIEPATH’, ‘/’);

    The only thing that comes to mind is a “minor error” that I received after walking through the “successful install” of bbPress…

    Duplicate key name ‘user_nicename’

    >>> User tables will already exist when performing a database integrated installation.

    I’m wondering if this is the problem. If so, I’m not sure how to fix it. : Can someone help?


    define(‘COOKIE_DOMAIN’, ‘*******’);

    define(‘COOKIEPATH’, ‘/’);

    to both wp-config and bb-config fixed this for me.


    I added it to both and the login still doesn’t sync.

    Do I need to do anything with this in the bb-config.php file?

    /* Stop editing */

    if ( !defined(‘BB_PATH’) )

    define(‘BB_PATH’, dirname(__FILE__) . ‘/’ );

    require_once( BB_PATH . ‘bb-settings.php’ );


    Ok. I figured out how to get the single login working for both bbPress and WordPress…

    I did understand the Function part of the setup.

    I made sure the bb-config.php file looked like this.

    if ( !defined(‘BB_PATH’) )

    define(‘BB_PATH’, dirname(__FILE__) . ‘/’ );


    require_once( BB_PATH . ‘bb-settings.php’ );

    my site is, so do I add to wp-config and bb-config: -

    define('COOKIE_DOMAIN', '');
    define('COOKIEPATH', '/');

    sorry im not that familiar with cookies and how to work them


    I hadn’t read the guide on merging with wordpress – I am building it into a CMS built for a client.

    I had already adjusted pluggable.php instead of simply editing bb-config and adding the cookiepath, d’oh!

    I actually have a working solution now. Instead of ussing about with automatic login the main website can generate a cookie that BBpress likes. I did have to modify wp_validate_auth_cookie and wp_generate_auth_cookie to include my own hash and adjust the config as pointed out above but otherwise everything is unmodified… so far!

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