Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Plugins for WordPress integration


bakedlogdotcom
Member

@bakedlogdotcom

I have successfully setup my site to integrate registrations/logins between wordpress on its own DB and domain (blog.bakedlog.com) and bbpress on its own DB and domain (forum.bakedlog.com).

Files:

WP: wp-content/plugins/bbpress-integration.php

BBP: my-plugins/wordpress-integration.php

  • I can create a user in wordpress and log into bbpress with it.
  • I can create a user in bbpress and log into wordpress with it.(although the default role set for wordpress does not let me write (how do i change this?))

However, I too cannot get cookies to authenticate between the two systems.

I have included the following in bbpress’s config.php:

$bb->cookiedomain = 'bakedlog.com';

$bb->cookiepath = '/';

I monitored the cookies created on my computer as I logged into each system, and noticed that bbpress was creating the cookie correctly, domain: bakedlog.com, while when I logged into wordpress it would set the domain on the cookie to blog.bakedlog.com.

So the problem is with WordPress..

Looking in WordPress’ wp-settings.php I see:

if ( !defined('USER_COOKIE') )

define('USER_COOKIE', 'wordpressuser');

if ( !defined('PASS_COOKIE') )

define('PASS_COOKIE', 'wordpresspass');

if ( !defined('COOKIEPATH') )

define('COOKIEPATH', $current_site->path );

if ( !defined('SITECOOKIEPATH') )

define('SITECOOKIEPATH', $current_site->path );

if ( !defined('COOKIE_DOMAIN') )

define('COOKIE_DOMAIN', '.' . $current_site->domain);

So, in WordPress’ wp-config.php I inserted:

// BBPRESS INTEGRATION

define('COOKIE_DOMAIN', 'bakedlog.com');

Clearing my cookies and logging into WordPress, I see the cookie domain is correct and matches my BBPress’.

But, there is still another problem, the cookies set by BBPress appends an md5 hash based on the site url and table prefix to the cookie’s name (ie: wordpressuser_bf17f59023eb22f…..) while WordPress’ cookie name is only: wordpressuser

I looked around in bb-settings.php and found:

define('BBHASH', $bb->wp_siteurl ? md5($bb->wp_siteurl) : md5($bb_table_prefix) );

if ( !isset( $bb->usercookie ) )

$bb->usercookie = ( $bb->wp_table_prefix ? 'wordpressuser_' : 'bb_user_' ) . BBHASH;

if ( !isset( $bb->passcookie ) )

$bb->passcookie = ( $bb->wp_table_prefix ? 'wordpresspass_' : 'bb_pass_' ) . BBHASH;

So, the next step is to define $bb->usercookie and $bb->passcookie in BBPress’ config.php:

// COOKIE SHARING WITH WORDPRESS

$bb->cookiedomain = 'bakedlog.com';

$bb->cookiepath = '/';

$bb->usercookie = 'wordpressuser';

$bb->passcookie = 'wordpresspass';

I cleared my cookies and tested it, VOILA! I can log into either section (bbpress or wordpress) and switch to the other without losing authentication!

==========SOLUTION===========

BBPRESS CONFIG.PHP:

// COOKIE SHARING WITH WORDPRESS

$bb->usercookie = 'wordpressuser';

$bb->passcookie = 'wordpresspass';

WORDPRESS WP-CONFIG.PHP:

// COOKIE SHARING WITH BBPRESS

define('COOKIE_DOMAIN', 'bakedlog.com');

==========********===========

Thats it I believe, let me know if it works for you or if you see anything I have done that could crash either program.

-BHensley.com

-Bakedlog.com

Skip to toolbar