A

Integrate bbpress forum with your wordpress setup

You are already familiar with WordPress but do you know about the great forum script bbPress which is a less lot in code and gives you the functionality of a forum without the burden of extra bells & whistles. Some of the benefits of integrating bbPress with WordPress are as follows : Users need to […]

wordpress-bbpress-integration

You are already familiar with WordPress but do you know about the great forum script bbPress which is a less lot in code and gives you the functionality of a forum without the burden of extra bells & whistles.

Some of the benefits of integrating bbPress with WordPress are as follows :

  1. Users need to register only once on your site to be able to login into both bbPress & WordPress
  2. Existing users will be taken care of (although I have no idea of conflicts in two tables if you were earlier running both of them independently)
  3. Users need to login only once and it will be reflected throughout the site (both in bbPress & WordPress)
  4. Uses the same database (makes backup easy)

Before you get on with this tutorial I would like to tell you that the latest stable version of bbPress at the time of writing this tutorial is 0.9.0.4 which integrates easily with WordPress 2.5

UPDATE: If you want to integrate WordPress 2.8 or 2.9 with bbPress 1.0 then head over to this integration tutorial. and if you want to upgrade your existing integrated setups of WordPress & bbPress then head over to this upgradation tutorial.

The reason that bbPress 0.9.0.4 is incompatible with WordPress 2.6+ is the change in the way WordPress handles cookies and the addition of more authentication unique keys. So, I am writing this tutorial for integrating bbPress 0.9.0.4 with WordPress 2.7.1.

UPDATE: This tutorial works for integrating bbPress 0.9.0.5 with WordPress 2.7.1 too.

The release of bbPress 1.0 will ensure that the integration process with WordPress to be a painless experience but if you can’t wait to try on, then read on.

INSTALL WORDPRESS FIRST

I have gone a little more to enhance the security of WordPress so please observe carefully, I will point out that at times.

Recommended but not Mandatory Steps

These steps are recommended and only need to be done if you are doing a fresh installation of WordPress. Changing them in existing installation needs more things to be done.

  • Change the WP prefix table from “$table_prefix  = wp_';” to something else like “$table_prefix  = 'rocking_';” in wp-config.php
  • Use WP secret key service to generate yourself authentication unique keys : https://api.wordpress.org/secret-key/1.1/ and paste them in wp-config.php

Required Steps

Open this URL : http://example.org/wp-admin/options.php in your browser and copy the following values :

  • auth_salt
  • secret
  • logged_in_salt

Now proceed to install bbPress.

INSTALL BBPRESS NOW

Make a sub folder in your WordPress directory so as to have the forums in the sub-directory. For example: Main site URL is http://example.org/ and forums URL is http://example.org/forums

Recommended but not Mandatory Step

Change the bbPress table prefix from “$bb_table_prefix  = 'bb_';” to something else like “$bb_table_prefix  = 'life_';” in bb-config.php

Required Steps

Install bbPress by opening http://example.org/forums/ and skip the WordPress integration part in Step 2.

Install it, login using the random password, change the password and then open WordPress integration settings under the Settings tab.

Fill the details :

  • WordPress address URL
  • Blog address URL
  • WordPress database secret (copied earlier from WP options page)

Add these two lines in bb-config.php

$bb->custom_user_table = 'wp_users';
$bb->custom_user_meta_table = 'wp_usermeta';

Change the table prefix if you have done it during installation.

Download this plugin : Freshly baked cookies

Install it in bbPress and open it for editing.

Fill the following details

  • LOGGED_IN_KEY (from wp-config.php)
  • LOGGED_IN_SALT (copied earlier from WP options page)
  • AUTH_KEY (from wp-config.php)
  • AUTH_SALT (copied earlier from WP options page)

Till now integration should be done but you might not be able to access the bbPress admin board anymore because we are sharing the USERS table and the bbPress is treating the admin user as a normal user so we need to get the rights back.

If you are using the default table prefix for both WP  and bbPress, then you can use this plugin : Fix Admin Access or else do it manually in phpMyAdmin. If you are using the plugin, then you can delete it as soon as it give the rights back to the admin user.

How to fix access in phpMyAdmin

Open the table wp_usermeta or rocking_usermeta or as per whatever you are using as your table prefix.

Change the value of following:

  • bb_capabilities => a:1:{s:9:"keymaster";b:1;}
  • wp_capabilities => a:1:{s:13:"administrator";b:1;} (make sure this is the value)
  • wp_user_level =>  10 (make sure this is the value)

You may have different fields if you have chosen to change the default table prefix.

Now you have got WordPress 2.7.1 and bbPress 0.9.0.4 integrated. Now they can do the talking. If you are having trouble then leave a comment & I will try to help.

24 responses to “Integrate bbpress forum with your wordpress setup”

  1. Payam says:

    Hi there,

    I am trying to follow your instructions to integrate bbpress 0.9.0.4 with wordpress 2.7.1 that is already installed on my website. I created the forums subfolder under wordpress directory. I have also ftp’d bbpress 0.9.0.4 to the root directory of my hosted site. I am not sure why http://example.org/forums/ should start the bbpress installation. If I go to http://example.org/bbpress-0.9.0.4/bbpress, the installation of bbpress starts, but I am not sure whether I should do that. When I go to http://example.org/forums/ as you are suggesting, I get “Sorry. We cannot find the location you are looking for.”. Shall I copy the bbpress folder to forums subfolder to make the first step work?

    I would appreciate your help.

    Best,
    Payam

  2. Ashfame says:

    @Payam
    Sorry your comment was caught as spam by Akismet.
    Well you need to have the bbpress files immediately under a folder “forums” if you want http://example.org/forums/ as your forums URL or “talk” if you want http://example.org/talk/ as your forums URL.
    Let me know if you need more help.

  3. […] next thing that I wanted to do was to see if the tutorial for bbPress integration with WordPress was working fine which I wrote a few days back. I tried on a localhost environment and it was […]

  4. david says:

    close but not close enough… Hi, I followed as best I could but I get this:

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    If I go to wp db tables users wp_users does exist! can you help please.

    if i upload fix plug i get:

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_usermeta’’ doesn’t exist]
    SELECT meta_value FROM ‘wp_usermeta’ WHERE meta_key = ‘bb_capabilities’ AND user_id = ‘1’ LIMIT 1

    bbPress database error: [Table ‘admin_illuminatus.‘wp_usermeta’’ doesn’t exist]
    INSERT INTO ‘wp_usermeta’ (user_id, meta_key, meta_value) VALUES (‘1’, ‘bb_capabilities’, ‘a:1:{s:9:”keymaster”;b:1;}’)

    bbPress database error: [Table ‘admin_illuminatus.‘wp_usermeta’’ doesn’t exist]
    SELECT meta_value FROM ‘wp_usermeta’ WHERE meta_key = ‘wp_capabilities’ AND user_id = ‘1’ LIMIT 1

    bbPress database error: [Table ‘admin_illuminatus.‘wp_usermeta’’ doesn’t exist]
    INSERT INTO ‘wp_usermeta’ (user_id, meta_key, meta_value) VALUES (‘1’, ‘wp_capabilities’, ‘a:1:{s:13:”administrator”;b:1;}’)

    bbPress database error: [Table ‘admin_illuminatus.‘wp_usermeta’’ doesn’t exist]
    SELECT meta_value FROM ‘wp_usermeta’ WHERE meta_key = ‘wp_user_level’ AND user_id = ‘1’ LIMIT 1

    bbPress database error: [Table ‘admin_illuminatus.‘wp_usermeta’’ doesn’t exist]
    INSERT INTO ‘wp_usermeta’ (user_id, meta_key, meta_value) VALUES (‘1’, ‘wp_user_level’, ’10’)

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    bbPress database error: [Table ‘admin_illuminatus.‘wp_users’’ doesn’t exist]
    SELECT ID FROM ‘wp_users’ WHERE user_login = ‘admin’

    un saludo. david

  5. Ashfame says:

    @David
    First of all take care of some formatting man.
    Now, check for two things.
    (1) Have you understood the point of changing the table prefixes and how to handle them at certain steps? If you are doing it on a fresh installation of both, then try doing it with the default table prefixes.
    (2) Make sure that you type the single quotes of the statement manually :
    Instead of
    $bb->custom_user_table = ‘wp_users’;
    $bb->custom_user_meta_table = ‘wp_usermeta’;
    It should be

    $bb->custom_user_table = 'wp_users';
    $bb->custom_user_meta_table = 'wp_usermeta';
  6. […] post: Integrate bbPress forum with your WordPress setup Tags: bbpress Comments0 Leave a Reply Click here to cancel […]

  7. […] This tutorial is for people starting with fresh installations of WordPress 2.8 & bbPress 1.0. Tutorial for upgrading the existing installations will be in a separate post (I will add the link here). And if by any chance you want to integrate WordPress 2.6 or 2.7 with bbPress with 0.9, then head over to this tutorial. […]

  8. […] 2.8 with bbPress 1.0 a few days back and today I am writing instructions for upgrading your integrated WordPress 2.7 & bbPress 0.9 installations as we needed some workarounds to previously integrate them but now integration between them is a […]

  9. Rashmi Mehta says:

    Hi Ashish,

    Been thru your blog and found it pretty techy for someone like me, who has been more on the marketing front for over 17 years now. I have also been thru your services list. My blog is on squarespace.com which is an editor based blog hosting service. Can u please assess my blog and suggest whether it would be better to continue on an easy interface like Squarespace or should i go for wordpress, since i need to build a new website very shortly.

    Thanks for your time in advance & look forward to your reply.
    regds
    Rashmi

    • Ashfame says:

      @Rashmi
      I guess you are using a different CMS other than WordPress and I would definitely recommend WordPress MU for a site like yours.

  10. […] lost the capabilities of an administrator with your user. Earlier it happened with users trying to integrate bbPress 0.9 with WordPress 2.7 or 2.8 but documenting it so that some day it might help anyone is a good […]

  11. Raffaell says:

    Hi there,

    Thanks for such great tutorial. I just follow all your tuts and its works like a charm, but now how about the tags ? I dont know where should I put my old bbpress tag, as new installation and automatic integration the bb_tags is no longer in the database.

    • Ashfame says:

      @Raffaell
      Do you have the database backups of previous versions? If that’s the case, then I would suggest upgrading the database first by upgrading a previous installation & then running the database upgradation script within bbPress.

  12. GKauten says:

    Thank you for the tips on user roles. After setting up bbPress Integration it wiped out both my WP and bbP logins. I was able to get the WP login back but not the bbP until I read your post. Now just to work out the cookies issue so that logging in to one admin does not destroy the admin cookie for the other. Cheers!

  13. Kalyani says:

    Hi!

    I’m using bbpress as a plugin with Buddypress and WPMU….can you tell me how to add subforums?

    Also, I’m having Login issues with forum /Cannot login directly after signing up. Caused by plugin Invisible Defender installed to prevent Splogging. After many trials this was the only plugin that gave satisfactory results. Logging in normally works though.

    Thanks!

  14. Sean says:

    Greeting Ashish. Apologies if this is not the most appropriate place for this line of questioning, but you definitely strike me as one that might have a solution for me… or at least get me started in the right direction. It’s definitely within the category of integrating WordPress+bbPress, but the real trick here is I am trying to use the s2Member plugin to register members to the site I’m working on. The plugin is working great for me so far and I’ve got bbPress deep integrated successfully.

    The problem lies in the custom member roles that s2M creates and how they are not the standard WP user roles for bbPress… so the members within the forum have no role assigned to them. I suspect that the answer lies in creating a new table in my DB that assigns the custom s2M roles to the standard bbPress roles (really just trying to make them all a bbPress “member”) and then somehow query that on loading bbPress. Only problem is, that is way over my head. Do you have any suggestions on how I could go about doing that?

    I’m not assuming that you are familiar with S2Member, but I’d bet you know what I’m talking about regarding mapping custom user roles. I would certainly appreciate any help/suggestions you can provide. Thanks!

    (WP 2.92, bbP 1.02, s2M 3.04)

    • Ashfame says:

      Hi Sean,

      You can make s2M fill bbPress roles while it creates roles for itself for a particular user. It surely can be done but I am running busy for a week, have my exams.

  15. sqllion says:

    Hi
    Thanks for the post. Its really very good. It helps me a lot in installing bbpress to my wordpress.

    But i didnt got any option for “WordPress database secret (copied earlier from WP options page)” in my bbpress instalaion
    Thanks,

  16. Melissa says:

    Hi, it seems that I was able to follow your wonderful walkthrough until the very end. I have tried installing the fix-admin-access plugin to no avail; I still cannot get into my bbpress admin panel.

    I also tried to edit via phpMyAdmin but I do not have the following fields under the wp_usermeta:
    bb_capabilities => a:1:{s:9:”keymaster”;b:1;}
    wp_user_level => 10 (make sure this is the value)

    (WordPress and bbPress table prefixes are set at default) Obviously I have gone wrong somewhere. Do you have any insights?

    Thanks