Skip to:
Content
Pages
Categories
Search
Top
Bottom

WP 2.6.3 & bbPress 1.0A2 slight fix


  • John Doe
    Participant

    @deadmedic

    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!

Viewing 8 replies - 1 through 8 (of 8 total)
  • while ($stars_in_heavens) {
    deadmedic.karma += extra_scoop_of_icecream();
    deadmedic.praise_sung += 1;
    }

    You fixed it.

    Here I was searching for all instances of setcookie…novice error!

    WP2.6.3; bbPress 1.0a2; PHP5; Apache 1.3

    I can log in and out of WP and bbPress from any direction!

    I did not use the .htaccess edits, just the rtrim line.

    Thank you, so very much!

    I wonder if this is going to solve my bbSynch and bbLive issues?

    BTW, there is a WP plugin to skin the wp login. They have a flickr group to share what people have done.

    I like the idea of funneling registrations through bbPress, as most of my members will hit the fora.

    I have to go and clean up some nasty things I’ve been saying around the web about integration…

    Thanks again, man.

    Cheers.


    John Doe
    Participant

    @deadmedic

    Glad to help musnake!

    Thanks for the heads up with the custom WP login :D

    >> 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’m still having that problem, even after following those directions.

    I have my WP site URL as root, but the wp-home is set to /blog (since that’s where the blog folder is).

    Cookiepath is set to /forums/

    sitecookiepath is set to /blog/

    @ipstenu: So your bb-config.php has:

    $bb->wp_siteurl = 'http://ipstenu.org/blog';
    $bb->wp_home = 'http://ipstenu.org/blog';
    $bb->cookiedomain = '.ipstenu.org';
    $bb->cookiepath = '/';
    $bb->sitecookiepath = '/';
    $bb->admin_cookie_path = '/forum/bb-admin';
    $bb->core_plugins_cookie_path = '/forum/bb-plugins';
    $bb->user_plugins_cookie_path = '/forum/my-plugins';

    etc.

    and your wp-config.php has similar entries:

    define('COOKIE_DOMAIN', '.ipstenu.org');
    define('COOKIEPATH', '/' );

    etc?

    I have this:

    $bb->wp_home = 'http://ipstenu.org';

    Since I did this: https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory ages and ages ago.

    But the rest, essentially, yes :)

    Okay, I did some testing of

    $bb->wp_home = 'http://ipstenu.org'; and $bb->wp_home = 'http://ipstenu.org/bblog'; and ffft.

    So. This doesn’t really bother me much, since I don’t mind people double-logging in. It’s only annoying in the realm of I hate when code doesn’t work right! :)

    WP 2.6.3, BP 1.0-alpha-2

    bb-config

    // WordPress cookie integration speedup
    $bb->wp_siteurl = 'http://jorjafox.net/blog';
    $bb->wp_home = 'http://jorjafox.net';
    $bb->cookiedomain = '.jorjafox.net';
    $bb->cookiepath = '/';
    $bb->authcookie = 'wordpress_DELETED';
    $bb->secure_auth_cookie = 'wordpress_sec_DELETED';
    $bb->logged_in_cookie = 'wordpress_logged_in_';
    $bb->admin_cookie_path = '/forums/bb-admin';
    $bb->core_plugins_cookie_path = '/forums/bb-plugins';
    $bb->user_plugins_cookie_path = '/forums/my-plugins';
    $bb->sitecookiepath = '/';
    $bb->wp_admin_cookie_path = '/blog/wp-admin';
    $bb->wp_plugins_cookie_path = '/blog/wp-content/plugins';
    // End integration speedups

    WP-config

    // Cookies
    define('COOKIE_DOMAIN', '.jorjafox.net');
    define('COOKIEPATH', '/' );

    I’ve also tried with no cookie settings in my wp-config. Right now it’s commented out. It’s sharing the admin cookie, since I can get into WP-admin if I log in with BBpress, but I don’t show up as a user (if I go to make a comment, it gives me the screen anon users see). If I log in via WP, I’m only logged into WP.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Curious if you’ve tried the steps in my wp2.7 topic? It should essentially be the same as with 2.6.3 and everything works pretty well other than the wp header integration.

    If I add

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

    to my wp-config file, I can’t log in at all. But other than that, yes. Those directions are mostly the same as these, except for the sitecookie hack.

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