Trackbacks
- No Trackbacks
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.
Download the latest stable version of WordPress from Wordpress.org and the latest version of bbPress from bbPress.org
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.
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.
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.
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.
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.
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.
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.
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.
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.
one more thought: how can I disable registration with bbpress?
I am using it as a forum for my wpmu install, so I only want people who have a blog with me able to log in, I don’t want people signing up with bbpress.
hello.
noticed I still have a problem: users of subdomains, aka people who have a blog i.e. test.zice.ro don’t stay logged in because the forum is on the main domain
somethign went wrong
if you wanna have a look get a blog on http://zice.ro and check it out
this is solved, was due to my mistake
HELP!
I just discovered a huge problem after this whole integration.
All users who had a forum, based on simplepress forum or jsut a page named forum, are now redirected to the main forum???
i.e. http://sasha.zice.ro/forum/ this users forum just links straight to the main site forum. Please give me some advice
and now a permalink related question: I isntalled bbpress inside a folder called forum. basically I want the forums at mysite.com/forum but with this setup, the topics look like mysite.com/forum/forum/topic – it seems its duplicating that foum in the structure
oh, and regarding step8, the bbpress documentation http://bbpress.org/documentation/integration-with-wordpress/ says:
you need to put require_once(‘path/to/wp-blog-header.php’) into the bb-config.php and not a include_once as you said above. Or doesn’t that matter? sadly I have no clue about PHP so I jsut wanted to let you know.
Btw. I am having trouble including some plugins in bbpress. I.e. I have a plugin running on wpmu that inserts itself into the wp_footer hook, so now in my bbpress template I included the but still no go
one more question, maybe you’ve got experience with it.
It all seems good, people who sign up for wpmu automatically are a member, as I set up in mz bbpress options but my existing users were not automatically assigned user roles.
what would be the easiest way to make all existing wpmu users, regardless of their status into memebrs of the bbpress isntallation?
I used your howto and this one http://umwblogs.org/wiki/index.php/Integrating_WPMu,_BuddyPress,_and_bbPress and I am jsut not sure about your step 8. what exactly is step 8 good for?
Hello, thanks for the walk-through. FYI I just did this using WP 2.8 and BBPress 0.9.0.5 (I know that’s later than you have tested here) and it works for login but there is a problem with logout. When you logout of the forum the cookie isn’t cleared (I think) so you can’t log back into the forum until you manually also logout of WP. So it must not be properly logging out of both.
There is also a fatal typo in bb-includes/compat.php line 108. It should read:
!function_exists( ‘_mb_substr’ )
rather than:
!function_exists( ‘_mb_subcut’ )
Cheers, and thanks for your work.
Hi Mohit,
Just thought I’d drop in a comment to say a MASSIVE thank you for your outstanding guide. It really helped me out as I was struggling to get the 2 working together. I really appreciate the time and effort you’ve put into this. It saved me ripping out what little hair I’ve got left!
My only slight problem now is that people can’t log in from the BBpress side without ticking the “remember me” box but that’s nothing compared to the problems I had before.
Many thanks once again.
Cheers
John
not sure if this is working right for the recently released bbpress
when I add
if ( !defined(‘ABSPATH’) & !defined(‘XMLRPC_REQUEST’)) {
define(‘WP_USE_THEMES’, false);
include_once( ‘/home/affiliat/public_html/wp-blog-header.php’ );
header(“HTTP/1.1 200 OK”);
header(“Status: 200 All rosy”);
}
it doesnt let me log in but if I remove this I am able to login – but still not syncing
Hi CSS Jockey,
I love your themes and website, they truly are beautiful to look at. I like your attention to detail
Thank you for this tutorial. I was wondering if you’ve heard of Simple:Press Forum? It’s a forum plugin for WordPress that integrates fully straight out of the box http://simplepressforum.com/ . It’s been stable way before bbPress ever was, and its literally got thousands of active users, and excellent support. Every question without exception on their support forum is answered and they listen to user feedback while constantly adding feature requests and improving the code.
They’ve also got a comprehensive online help within the plugin backend, which makes it easy for newbies to play around with.
hi, thanks for your tutorial, is very useful!
i’m a problem, when i try to access in my bb-admin it redirect me to forum home, any idea to resolve this problem? thanks!
hi,
i followed all the instructions, and when i first logged in,
it displayed this message:
“All Rosy”
Page is moved to here
Same when I log out.
So I took out this line from the BB Config file and now it works. Is this correct way to do it?
I took out following line and it works now.
header(“Status: 200 All rosy”);
Can I apply this to WPMU & bbPress integration?
There’s this useful WPmu, BuddyPress, bbPress integration guide that I refer many of my clients to.
The header status line (header(“Status: 200 All rosy”);) is causing a bit of an issue for me. The integration is working completely but when logging in via the forums, I get a “wingding” display using firefox & in IE – it’s an “unknown filetype” error for bb-login.php. If I refresh the forum page I am logged in, though, after this occurs . This is also happening when on the settings page when I click the update settings button.
If I remove that header status line, all appears to be working perfectly.
What are the implications of leaving the line out in this instance?
Thanks for the great writeup!!
This was an awesome guide; No other guide had said download the WordPress Plugin, hence my frustration at it not working.
To anyone reading this, It is possible to do this on existing Wordpress Installations but if you also have a bbPress with existing users I believe there is a conflict. Hopefully the bbPress team releases version 1.0 with a better dashboard.
Thanks
Sidenote; once you do the final step, if you try to access to Dashboard(s) you will be in an infinite loop. As pointed out, clear your web data.
Hi, thanks a lot for your tutorial quite clean… but I don’t understand what you mean at the end when you say…
“…You can now use WordPress template tags in your bbPress theme and style it similar to your WordPress theme…”
I’m using Tarsky theme at the moment and that’s what i get installing my Tharsky theme… i destroyed completely the forum’s layout.. what should you advice me? Thanks a lot….
Antonio
Hi Antonio,
We are talking about bbPress forums software, here. But the forums that you linked to are based on SMF.
Great write up.
However, look at the code you wrote:
if ( !defined(‘ABSPATH’) & !defined(‘XMLRPC_REQUEST’)) {
define(‘WP_USE_THEMES’, false);
Shouldn’t the & be just & ?
Again, thanks. After I figured out this was causing the error, it worked great.
Carl
I followed your instructions. I got minor errors.
Duplicate key name ‘user_nicename’
>>> User tables will already exist when performing a database integrated installation.
Step 1 – Creating database tables
>>> Added index wp_users UNIQUE KEY user_nicename (user_nicename)
>>>
>>>>>> Duplicate key name ‘user_nicename’
There were some errors encountered during installation!
New to this wpmu, buddypress, bbpress install.
Hi CSSJockey!
Thank you very much for this clear tutorial.
But there is one problem: my bbpress forum shows a blank page after I added the following code:
if ( !defined(‘ABSPATH’) & !defined(‘XMLRPC_REQUEST’)) {
define(‘WP_USE_THEMES’, false);
include_once( ‘/home/forum/www/html/wp-blog-header.php’ );
header(“HTTP/1.1 200 OK”);
header(“Status: 200 All rosy”);
}
And is it possible to show the forum directly on the Wordpress homepage?
Thanks in forward.
Anne Jan
I got this error
Parse error: parse error in C:\xampp\htdocs\forums\bb-config.php on line 2
Plis help, I did as you said
odd bug with doing this – it seems to make all bbPRess users have my name and email (or rather, it does as soon as they are edited).
The problem seems specifically with the blogheader include. Commenting that out stops it.
This is using the latest stable releases of both bb and wordPress.
Hey, awesome walkthrough; saved me a a bunch of time! You have gained a returning user. Cheers!
Great write up! I have been thinking about making a little forum and wanted something simple and easy to integrate. Thanks the info.
10 Mar, 2010
i’ve used these steps but now i m unable to login on my bbpress