Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: WordPress + bbPress Integration 101

Cross-Domain Intergration

I’ve not seen anything about messy cross-domain integrations, so I thought I’d share my method. I’m using WordPress 2.8.6 with BBPress 1.0.2. Your mileage may vary on other versions. I suspect this method is not valid for 2.5/0.9.

The setup:

– example.com/blog

– example.com/forum

– example.org/forum

With shared user tables and database.

The config AUTH_KEY/SECURE_AUTH_KEY/LOGGED_IN_KEY should be the same for all (remember to add BB_ to the forum config files). Within the BBPress admin intergation, have the same auth/secure/logged in values for all forums (remember it’s the value shown within the WordPress options screen, not the values in the config files).

In this case cookiepath should be ‘/’ ($bb->cookiepath = ‘/’; // in bb-config and, define(‘COOKIEPATH’, ‘/’); // in wp-config). Set other $bb->style configurations as you wish.

Basically, everything is the same. Except: The Cookie Domain must be explicitly set**. And not always set to the same value.

In example.com/blog’s wp-config add: define(‘COOKIE_DOMAIN’,’.example.com’);

In example.com/forum’s bb-config add: $bb->cookiedomain = ‘.example.com’;

So far, so simple.

Now, in theory, example.org/forum can be set with $bb->cookiedomain = ‘.example.com’; // But I’ve not tried. Paranoid browsers would surely reject this. Instinctively having the forum rely on something that might look like a security risk is bad.

Instead, try adding this to example.org/forum’s bb-config: $bb->cookiedomain = ‘.example.org’; // Users will still need to log in separately when they switch domain, but all the other integration features seem to be fooled, with no adverse problems.

I’d welcome any feedback on this method. I’m still not sure this is the best approach.

( ** Not setting the cookie domain appears to work, until the user switches between domains – example.com/blog doesn’t simply fail to find a cookie set by example.org/forum, it may fail a fresh blog login until cookies are cleared. I’m not sure exactly what’s happening, but it’s messy.)

Skip to toolbar