As WordPress and bbPress both come from the same camp, successfully integrating both of them to share logins as well as template functions has been a buzzing issue for developers. In fact, because both WordPress and bbPress have an almost similar file management structure, it makes all the more sense to integrate bbPress as forums into WordPress rather than using phpBB or SMF or any other boards.
Various resources over the web are trying to explain the process of (deep) integrating WordPress and bbPress without any issues, but mostly they are broken or outdated. In this guide, we’ll explain the process of integrating the latest stable versions of both WordPress (2.7.1) and bbPress (0.9.0.4) step by step in a comprehensive way.
Step 1: Downloading the Latest Stable Versions
Download the latest stable version of WordPress from WordPress.org and the latest version of bbPress from bbPress.org
Step 2: Extracting the files
Extract the WordPress files into the root directory of your web server (or where you want to install it). Create a new database on your host using your phpMyAdmin or host’s cPanel.
Now, create a folder named forums inside the WordPress directory so that it forms a sub-directory of your WordPress website (for example www.YourDomain.com/forums). Now your FTP directory listing should look somewhat like this:
Extract the bbPress files into this forums directory.
Step 3: Installing WordPress and bbPress
Now install WordPress by visiting your website URL in your favorite browser (www.YourDomain.com) and Create a Configuration File using the name of the freshly created database and database username and password. You’ll be done through, quite easily.
To install bbPress as your forums software go to www.YourDomain.com/forums. When the installation page appears click on the Let’s Get Started link to begin with the configuration. Enter the same database name, user name and password as you used for your WordPress install. Don’t check the advanced settings. Just save your database configuration settings.
Step 4: Integrating WordPress into bbPress
The next option is basically where the integration process actually starts. Place a check against the add integration settings. Then place a check against the add cookie integration settings. This enables you to use shared logins.
This is also where the complication comes in, in the integration of WordPress 2.7.1 and bbPress 0.9.0.4. Cookie generation and management mechanism in WordPress 2.7.1 is very different from WordPress 2.5. However bbPress still uses the cookies compatible with previous versions of WordPress. We’ll use a plugin as a work around to downgrade the cookies generated by WordPress to sync with bbPress. Follow the steps below.
Step 5: Filling in the WordPress integration details
In WordPress address, enter http://www.YourDomain.com
In Blog address, enter http://www.YourDomain.com
Now go to https://api.wordpress.org/secret-key/1.1/ to generate WordPress Cookie secret keys. They’ll look somewhat like this:
define('AUTH_KEY', '3{=J|rF]CLK3XNzzKc+*Bn@2yeMh#y{c$PqfAgmW*WgPevIOEAi6Gl{b1');
define('SECURE_AUTH_KEY', '-P`&G!_+5|1uu`>8y9!$f;.T<6-Oa');
define('LOGGED_IN_KEY', '3xIsD$9TmGg;FAu.[V,nqb%lE/`N~)h4rE>cO`]@h vkN?`>fA0w;|FFb|_3NW40');
define('NONCE_KEY', '{qBV?O[wCsW5 Y+1^ ].%Y-Mp[0*m`$A@M3:;OHm=>&R*$I4Zlv7^n*+G`ib.#?a');
In your root directory, open the wp-config.php file. Look for 4 lines starting similarly… Replace them with the generated keys. Perform this step carefully.
Now copy the value of 'AUTH_KEY' that is
3{=J|rF]CLK3XNz<DGr|K>zKc+*Bn@2yeMh#y{c$PqfAgmW*WgPevIOEAi6Gl{b1
(whatever is generated for you) and go back to your browser. Paste it into the WordPress Cookie Secret Key field.
Now go to http://www.YourDomain.com/wp-admin/options.php and look for a field named secret. Copy the value of this field and paste it into the next field of bbPress configuration – WordPress Database Secret. Finally place a check mark against the Add user database integration settings. You don’t need to use the advanced settings. Just Save WordPress Integration Settings and proceed to the next step.
Step 6: Finishing bbPress install with Site Settings
Enter the Site Name and Site Address (mostly, it’ll be automatically guessed for you). Select admin in the username drop-down to map it as the Key Master. Type the name for your first forum and save site settings to finish setting up the forums.
Registration – Setting up User Roles
When a user registers on your bbPress forum, your WordPress blog doesn’t know about it (and vice versa). The user will be created, but WordPress won’t know what user role to apply.
In the “WordPress Integration” section of the “Settings” area in your bbPress admin you will find a “User Role Map” where you can set which roles will be applied to users who register on your forums. Users who register on your WordPress blog will have the appropriate role applied to their account when they first login to bbPress.
If you don’t setup a role map, then this will not work. When you do setup a role map (or change it) any users who are missing either role will be updated, but existing roles will not be affected.
Step 7: Modifying the wp-config.php file
Add these lines of code
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '/');
Just before this line:
// ** MySQL settings - You can get this info from your web host ** //
This would generally be near the top of the wp-config.php file at around lines 16 to 18.
Step 8: Modifying the bb-config.php file
Create a new blank file path.php and insert the following lines of code into it:
<?php $p = getcwd(); echo $p; ?>
Upload it into your root directory and access it from your browser at www.YourDomain.com/path.php. It would show you the absolute path to your website and would be something like this: /home/xyz/public_html/sitename/
Copy this path as we will paste this in the bb-config.php file.
In the forums directory, edit the bb-config.php file and insert these lines of code in line 2 immediately after the opening PHP tag ( <?php )
if ( !defined('ABSPATH') & !defined('XMLRPC_REQUEST')) {
define('WP_USE_THEMES', false);
include_once( 'PASTE ABSOLUTE PATH HERE/wp-blog-header.php' );
header("HTTP/1.1 200 OK");
header("Status: 200 All rosy");
}
Then, near the bottom of the file – add these 2 lines of code just before the /* Stop editing */ line
$bb->custom_user_table = 'wp_users'; $bb->custom_user_meta_table = 'wp_usermeta';
Save your bb-config.php file and exit.
Step 9: Installing a magical plugin
Ann Oyama developed a WordPress plugin that enables WordPress to generate cookies that work with bbPress 0.9 so that a single shared sign in can be accomplished between the two! Download this plugin at WordPress.org
Basically the cookies generated by the latest version of WordPress are downgraded to the cookies generated by previous versions of WordPress. Upload the plugin to wp-content\plugins\ and activate it from your WordPress admin dashboard.
After you activate the plugin, you’ll be asked to log in again into your WordPress admin dashboard. Instead of logging in once again – type
www.YourDomain.com/wp-login.php?action=logout
When you’re logged out, clear your browser’s cache and cookies. Restart your browser.
Step 10: There’s no step 10. Bingo!
You’ve successfully deep integrated your WordPress 2.7.1 with bbPress 0.9.0.4. You can now use WordPress template tags in your bbPress theme and style it similar to your WordPress theme… and you’ve a single sign-on shared login set up and running! I hope you find this guide helpful. If you face any problems, feel free to drop us a comment. We’ll try our level best to help you out.





10 Mar, 2010
i’ve used these steps but now i m unable to login on my bbpress