WP 2.6.3 & bbPress 1.0A2 slight fix
-
Ok, it’s a slight fix since it’ll only solve one of the issues (I was having) with integration.
The problem was that I could not for the life of me force bbPress to set a ‘logged_in’ cookie with path ‘/’.
WordPress: domain.com
bbPress: domain.com/forum/
This meant once I’d logged in via bbPress, when I was browsing WordPress (although it set the ‘auth’ cookie fine and I could view wp-admin/) it ‘appeared’ that I was logged out (log in and register link, instead of log out and site admin).
I’d already tried this in bb-config.php, along with the other ‘integration speedups’ bbPress supplied;
$bb->sitecookiepath = '';
I’d also tried setting it to ‘/’ as well, but every time the cookie would not get set.
And here was the culprit; line 673 in bb-settings.php;
$bb->sitecookiepath = rtrim($bb->sitecookiepath, '/');
Then on line 735, it checks if $bb->;sitecookiepath is not set or empty. Otherwise, the ‘logged_in’ cookie for sitecookiepath will not get added to the $cookies array, and hence will not be set when wp_set_auth_cookie is called (specifically line 172, pluggable.php).
Changing the culprit to this fixed it for me;
$bb->sitecookiepath = '/' . trim($bb->sitecookiepath, '/');
The complete fix (for me) was to force all logins, registrations and logouts through bbPress with this in a .htaccess at the WordPress root;
RewriteCond %{QUERY_STRING} action=register
RewriteRule ^wp-login.php forum/register.php [R=301,NC,L]
RewriteCond %{QUERY_STRING} action=logout
RewriteRule ^wp-login.php forum/bb-login.php?logout=1 [R=301,NC,L]
RewriteRule ^wp-login.php$ forum/bb-login.php [R=301,NC]
This actually worked out better for me, since bbPress by nature allows you to skin the login, and users get to enter a little more info for their profile during registration.
Hope this of some help to others!
- You must be logged in to reply to this topic.