Skip to:
Content
Pages
Categories
Search
Top
Bottom

WPMU 2.6.1 Integration Success with 1.0-alhpa-2

  • I have seen lots of posts with folks having trouble getting integration to work. I am on 2.6.1 and 1.0-alhpa-2 and I have everything working with no problems.

    The one gotcha that I found that I have not seen mentioned: COOKIEHASH in the wp-settings.php file. It currently ships empty in WP, and probably most people left it blank like me:

    define('COOKIEHASH', '' );

    The hash is calculated in bb-settings.php:

    define('BB_HASH', $bb->wp_cookies_integrated ? md5($bb->wp_siteurl) : md5($bb->uri));

    Since bbPress is hardcoded to use an MD5 hash of the domain appended to all cookies (when you are integrating), you need to have the matching hash appended to your WP cookies.

    The hash is added to the cookie to make it unique, like

    wp_logged_in_user_3ffce08ac7419977b5ab9d68969a4cd0

    To fix this to match bbPress, set it up like this in wp-settings.php:

    define('COOKIEHASH', md5(get_option('siteurl')));

    Or even better calculate it once to avoid the get_option overhead and hard code it.

    define('COOKIEHASH', '3ffce08ac7419977b5ab9d68969a4cd0');

    Bonus points for anyone who can guess the hash above. Yes, it’s md5 and one-way, but on this forum, the answer should be pretty obvious.

    The form of the url passed to md5 should be ‘http://mysite.com’ with no trailing slash.

    One more cool thing: I do not allow registration on the support forum, only through the main WP site. In order to enable posting in the forum from the moment of signup, add a plugin in you mu-plugins directory containing the following:

    function enable_forum_new_user( $user_id )  {
    update_usermeta($user_id, 'bb_capabilities', array('member' => true));
    return;
    }
    add_action('wpmu_new_user', 'enable_forum_new_user');

    Now your users can hit the forum and post the second they click their confirmation email. Cool, huh?

Viewing 12 replies - 1 through 12 (of 12 total)
  • I have released the enable WPMU users part as a plugin.

    You can download it here:

    https://bbpress.org/plugins/topic/wpmu-enable-bbpress-capabilities/

    Hey eagno,

    In WP2.6.2 wp-settings.php line 297…

    Doesn’t this block of code get executed whenever one is not installing, i.e. usually. Isn’t COOKIEHASH usually generated?

    if ( ! defined('WP_INSTALLING') ) {
    // Used to guarantee unique hash cookies
    $cookiehash = md5(get_option('siteurl'));
    /**
    * Used to guarantee unique hash cookies
    * @since 1.5
    */
    define('COOKIEHASH', $cookiehash);
    }

    musnake –

    I think this must be a big source of the problem for MU and getting it to work with bbPress. And why some get integration to work (standalone) and other can’t (wpmu).

    In the WP standalone install, it does indeed appear to be there (is that where you got the code above?).

    In WPMU 2.6.2 (https://mu.wordpress.org/latest.zip) wp-settings.php, line 317:

    // Used to guarantee unique hash cookies
    $cookiehash = '';
    /**
    * Used to guarantee unique hash cookies
    * @since 1.5
    */
    define('COOKIEHASH', '' );

    $wpdb->hide_errors();
    if( defined( 'MUPLUGINDIR' ) == false )
    define( 'MUPLUGINDIR', 'wp-content/mu-plugins' );

    if( is_dir( ABSPATH . MUPLUGINDIR ) ) {
    if( $dh = opendir( ABSPATH . MUPLUGINDIR ) ) {
    while( ( $plugin = readdir( $dh ) ) !== false ) {
    if( substr( $plugin, -4 ) == '.php' ) {
    include_once( ABSPATH . MUPLUGINDIR . '/' . $plugin );
    }
    }
    }
    }

    Want to know the funny part? I actually debugged it instead of going to the source in WP standalone. At least I came to the same conclusion. This should probably be reported as an MU bug – I’ll let Donncha know.

    Yes, I was referring to the WP single user version, not the WPMu flavor. Thanks for clarifying this!

    I have entered a ticket for WPMU:

    https://trac.mu.wordpress.org/ticket/775

    Ooops – please see my conversation with Donncha in the ticket above.

    The short story: defining COOOKIEHASH as md5(get_option(‘site_url’)) will work for the main blog but not any other blogs if you are using VHOST (subdomains).

    There is a fix/hack: calculate the md5 hash of your domain, and use that value to define COOKIEHASH.

    define('COOKIEHASH', md5('http://yourdomain.com');

    No subdomains, no trailing slashes, will work fine.

    You can also get this value from bbPress speedup settings, found at Settings, WordPress Integration, and the bottom of the page.

    $bb->authcookie = 'wordpress_biglonghashvalue';
    $bb->secure_auth_cookie = 'wordpress_sec_biglonghashvalue';
    $bb->logged_in_cookie = 'wordpress_logged_in_biglonghashvalue';

    In your wp-settings.php,

    define('COOKIEHASH', 'biglonghashvalue');


    buzz_lightyear
    Member

    @buzz_lightyear

    hi guys,

    very nice, but what does it actually mean in the end?

    Is it possible to integrate wpmu 2.6.2 with bbpress 1.0-alpha-2 or not?

    thanx

    buzz

    If so, it kicks the chocks away from a huge cart-O-wpmu that I’ve had sulking on the backburner since 1.6…


    zachblank
    Member

    @zachblank

    @eagano – Hello, I am an experienced WordPress and bbPress developer. I followed your example exactly and have the integration perfectly. Only issue is when I load in WordPress functions bbPress becomes buggy. I am still able to login as before on each eite and become logged into the other. Although being logged in as a Key Master i am not able to access bb-admin nor am I able to reply or post a new topic. when looking at a topic i see the reply header at the bottom of the page but the for is missing. Investigating showed me that the details in bb_current_user and different with the functions integrated. And ‘allcreds’ is non existent in that object. making me unable to do anything on the bbPress install. Thanks for your help! Grate comments above.


    Sam Bauers
    Participant

    @sambauers

    @buzz_lighty

    Yes, integration you describe is possible. The only problem is if you try to load WordPress inside bbPress

    @zachblank

    As above. All the issues are being compiled on a single Trac ticket:

    https://trac.bbpress.org/ticket/972


    buzz_lightyear
    Member

    @buzz_lightyear

    @sambauers

    thanx for info sam.

    i wanted to have bbpress loaded into wpmu (as i see it). I’d like to create a page under wmpu, where bbpress can be loaded into.

    Same as i had integrated Phorum.org forum into Mambo.

    thanx for info, i’ll be watching that trac ticket.

    buzz

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