Update: I have written an updated article after the new releases and it can be found here.
http://www.adityanaik.com/integratepress-part-i/
I have been working on bbPress for quiet sometime now. Since most of use using both wordpress and bbPress integrated them and create similar themes, I thought I’ll add support for the bbPress forum Themes to all the wordpress themes that I create from now onwards.
Here is primer for integrating Wordpress and bbPress Themes:
bbPress Configuration
$bb->wp_table_prefix = 'wp_';
You can find this information in the wp-config.php file in the wordpress installation directory.
$bb->wp_home = 'http://www.<your_website>.com/ <your_blog_directory>‘;
$bb->wp_siteurl = ‘http://www.<your_website>.com/ <your_wp_installation_directory>‘;
You can find these information in wordpress admin page. Go to Administration > Options and you will find these values under the ‘General Options’ Tab. If you are installing bbPress in a folder other that subfolder of the wordpress installation, you might run into some cookie trouble. Have a look at this and fix the cookie definitions.
define('WP_BB', true);
Set this value in the config file so the functions defined in Wordpress are not redefined.
require_once( '/path/to/wordpress/config/file/wp-config.php');
Update: Add the above statement to the config.php in bbPress. Note that this statement goes on top of the file before everything!. This will get all the functions from Wordpress into bbPress.
Plugins
You will have to install two plugins one for wordpress and one for bbpress. So that whenever a user signs up on either of the softwares it will add permissions for the other forum and the second one to manage how the name is displayed.
Download the Wordpress plugin from here and the bbPress Plugin from here
And now you are all set.
Integrating the themes is done. now you can just drop this template (Update Note: the template is outdated. You can download the latest file from here http://www.adityanaik.com/integratepress-part-i/) in my-template folder and the template is wordpress ready! All this template does is call get_header from wordpress rather that bb_get_header from bbpress. this way any change you make in wordpress template reflects in bbpress immediately.
So I believe I’ve followed all of the steps you give, but thus far cannot get the forum to work after modifying this part of the config file (below the comment that says “stop editing”):
require_once( ‘/path/to/wordpress/config/file/wp-config.php’);
I made the path absolute (begins with http://) because I got an error that the config file couldn’t be found otherwise (perhaps because I’m running php on a Windows box?).
Here’s the error I get now when I try to go to the main bbPress page:
Fatal error: Call to undefined function: do_action() in d:\mysiteroot\wordpress\forum\index.php on line 6
If I try to go to the admin page now, I get this:
Fatal error: Call to undefined function: bb_auth() in d:\mysiteroot\wordpress\forum\bb-admin\admin.php on line 4
I’ve activated and configured the WP plugin you link to and uploaded the bb plugin to the my-plugins directory and uploaded the my-template file you made available
…what else am I missing here?
the absolute path is always the system path not the url.. so your absolute path will be ‘d:/mysiteroot/wordpress/wp-config.php’
try this and let me know if it works..
That moved me past the first error when I try to go to my new forum home page, but now I get a new error, as i it can read the WP functions, but not the bb functions:
Fatal error: Call to undefined function: get_forums() in d:\mysiteroot\wordpress\forum\index.php on line 11
Do I need to re-run the install in order for everything to be pulled in correctly, after I changed the config file?
thanks for the help!
I’ve followed all the steps here but I still just get the basic, default bbpress theme, not my Wordpress theme. I have no errors or anything, but nothing has changed. Would the Wordpress K2 theme create a problem?
I’ve continued to fiddle with the config.php and just cannot get it to work — the error “Call to undefined function: get_forums()” seems to be the most recurrent error. I can get other to appear by doing different things to the config file, but that just seems to be regressing based on those errors. Any other help would be much appreciated.
can you tell me what changes you have made and what is the content of the config.php exactly
I have these settings configured correctly:
$bb->wp_table_prefix = ”;
$bb->wp_home = ”;
$bb->wp_siteurl = ”;
If I use only these additional two settings, the forum will work by itself:
define(’BBPATH’, dirname(__FILE__) . ‘/’ );
require_once( BBPATH . ‘bb-settings.php’ );
That doesn’t do the integration, though, with WP, so I tried adding in these settings:
define(’WP_BB’, true);
require_once( ‘d:\mysiteroot\wordpress\wp-config.php’ );
I’ve tried using either one or both of those; I’ve also tried using those and taking out
define(’BBPATH’, dirname(__FILE__) . ‘/’ );
require_once( BBPATH . ‘bb-settings.php’ );
…but that doesn’t work either.
you need to have all four statements
these:
$bb->wp_table_prefix = ‘’;
$bb->wp_home = ‘’;
$bb->wp_siteurl = ‘’;
I assume you have filled in values..
these:
define(’WP_BB’, true);
require_once( ‘d:\mysiteroot\wordpress\wp-config.php’ );
need to go on the top of the config.php file before everything else..
Adding those two config settings to the *top* of the config.php file fixed it — now it works great! Thank you!
glad it worked for you!
cheers!
Your article is very informative and helped me further.
Thanks, David http://www.google.com
Thanks David.. I’m glad to help!
Hi. I’m trying to get the template thing working with the newest stable version of bbpress and it doesn’t work. I downloaded the “my-templates” folder and it doesnt have a header.php or footer.php. Is it for an old version of bbpress?
yup.
1. it works with the old release.
2. it does not have a header and footer because it takes the header and footer from the wordpress theme.
I’ll have to release the file with updated stuff for the latest release. thanks for the heads up.
if you would like to it yourself. all my tempalte does is replaces the bb_get_header() with get_header() in all the template files..
A simple solution for the latest bbpress: follow the steps above except installing the template. Instead, replace the contents of the default template header.php with and the contents of footer.php with
Hi,
Thanks for this information. I’m trying to integrate bbpress into my current theme, but I’m stuck. Registration part is done, but in which file do I put that last (require) code?
Thanks in advance
the require statement goes in the config.php at the top of the file. may be i should up date the article :)
Hi. I’ve tried to get this working with wordpress 2.1 and the newest version of bbpress. Everything appeared fine except that wordpress states that my admin user doesn’t have the correct rights to access wordpress after bbpress is installed.
Do you know why wordpress won’t allow the admin to log in after bbpress is installed (separate folder ‘forums’)?
Thanks.
Intuitively, I don’t know what could be wrong. check for following things.
did you put the plugin for bbpress in the right place and wordpress plugin is activated.
second can you log into bbpress if yes. may be its a cookie thing.
I could help you debug. let me know.
Hi Aditya. How are you doing? I have been trying to integrate WP with BBpress using this guide from the past 4 hours or so and all my attempts have gone in vain. First of all, I would like to know if I need to use the same database for WP and BBPress? At first both were using two different databases and I was getting an error which stated that the script couldnt find table wp_users in the database. So I thought I need to use the same DB for both the installations. I did that. Everything seems to work but I am not able to access the BBPress admin panel. And I assume the line define(’WP_BB’, true); needs to be added in the config file of BBPress, am I right?
Please get back to me soon. Thanks
– Naif
Yup both have to be in the same db.
Yes. and this needs to be place before the line which says - /* Stop editing */
you said you couldnt access the admin panel. firstly make sure you have the installation for wordpress up and running before you go and install the bbpress.
let me know if you need help.
Hi,
Thanks for the help so far, its helped me a lot so far.
But I seem to be stuck at this point:
http://www.dodge-srt8.com/forum/
I can get most of the header and the footer (though it is positioned wrong) but all the forum layout gets messed up and has no styling.
Any suggestion would be very helpul. Thanks
-Erik
I can see the frontpage but the links don’t work because of the rewrite mod. check the documentation for pretty URLS. you will have to add multiviews to htaccess.
Hi,
Followed your instructions, and the ones on the bbpress.org, everything seems to be working, except for the my-theme, this of coarse is because of the sub.domain.com route, how would I go about this to achieve the same result, because this what you did is amazingly simple solution for a headache problem ;)
Thanx, Daddo
There are a couple of things you can do to your site.
I saw that you tried the permalinks. you wil have to change the .htaccess file to ass multiviews option. have a look at this
If the problem is with the cookies check this out.
i didnt really understand your my-theme problem.. can you tell me more about the problem?
Hi,
Thank you for the permalink tip it worked!
As for the my-template it could have been that I’ve misunderstood, but I got the impression that the template file you offered for download would integrate my WordPress theme with bbPress one, if it is supposed to do this, it’s not happening at my forum, or is it that I have to add the css style that will simulate my WP theme design, and how about the wp header could you elaborate.
This is not clear to me and is certainly due to my inexperience with such issues, if you can see through this where did I go wrong, please advise!
Thank you !!!
it should automatically.
i need to know a couple of things:
- which ver of bbpress are you using?
- have you activated the theme in the theme admin?
- have you dropped the files in a sub dir of the my-template dir?
1. bbPress v.0.8.1
2. do not see it in the admin
3. dropped filez in my-templates folder
actually dropped it as I downloaded it, since it was in the folder named my-templates and I didn’t had one.
with some changes that have been added to 0.8 you will have to move the files to a sub folder in my-templates. call it newtheme or something.
then activate the theme. to do that go to admin and to the presentation tab. for more info see this and this
Yes ! that worked,
However now this appears ;
Fatal error: Call to undefined function get_header() in /forum.driftkikker.com/my-templates/dK/topic.php on line 1
As I saw, line one calls for the wp_header, and I’m in a sub.domain.com, is there something I should adjust?
make sure that you have the following in the config.php
define('WP_BB', true);require_once( '/path/to/wordpress/config/file/wp-config.php');
replace ‘/path/to/wordpress/config/file/’ with the absolute path to wordpress. also make sure this is at the top of the config.php
Now I’m not sure what am I supposed to see,
Did what you suggested, had a few routing errors, corrected it got another few, last one was with Tag Warrior, disabled it, and now all is back to default, care to have a look at forum.driftkikker.com
forgot about the wp_cash it stalled the refresh a bit, it works now, I do get in topics ;
This topic is
Fatal error: Call to undefined function topic_resolved() in /mydomain/my-templates/dK/topic.php on line 14
ok.. the problem is that template i have have provided will use wordpress header and wordpress footer. other than that it will not style the forum at all!
you will have to style the forum to your needs. i see this page
http://forum.driftkikker.com/forum/1and looks like you have the header and footer from the wordpress. you will need to add styling for the forum to fix the garbage.
also please check if you have replaced frontpage.php in the template folder.
for the topic.php.. that particular function was removed from bbpress from version 0.8. what you can do to fix this is just take the topic.php from default theme and change calls to bb_get_header() to get_header()
Thank you ever so much Aditya,
You are the KING !!!
I think I can manage from here ;)
All the best, and my sincere appreciations for your help !
Keep up the great work!
Many friendly greetings, Daddo
Thanks for this modification Aditya. One question:
do you know why the forum’s index page will not take the WP header and WP footer? All the other pages of the forum do take it.
http://foodiephotos.com/wp/forum/
duh! my bad.. i think the file was missing..
try downloading now. it should work now
Bingo! That was it. Thanks so much for your help.
You’re welcome
Thanks for the tips.
I have wordpress-mu at blog.domain.com and bbpress at forum.domain.com/bbpress.
When I add
define(’WP_BB’, true);
require_once( ‘/usr/home/abc/htdocs/blog/wpmu/wp-config.php’);
to config.php in bbpress, http://forum.domain.com/bbpress redirects immediately to http://blog.domain.com.
I must be doing something obviously wrong. Any ideas?
bbpress 0.8.1
wordpress-mu 1.2.1
try this
require_once( ‘/usr/home/abc/htdocs/blog/wpmu/wp-blog-header.php’);Thanks.
Unfortunately, it still redirects to the blog homepage.
I have installed your ‘my-templates’ folder unchanged.
The link to the bbpress plug-in in your article seems to have moved - so I have no bbpress plugins installed.
Cheers,
Tony
the plugins shouldnt be a problem. all the plugin does is share users between wp and bbpress.
I haven’t tried the bbpress install with wpmu, have you posted this problem on the bbpress forum?
Also the theme needs to go in a subfolder of the my-templates folder.
Do let me know if you find a solution.
I don’t get the theme connected, but the user logins work (yay!). Followed all instructions on this page, but something’s wrong.
You said replace frontpage file in, but that’s the first I heard that. Replace with what? Also, Presentation page does not recognize the new template — just empty box for second theme, because no style.css. So do I need to put a css file there. From the WP theme folder?
I have “my-templates” folder in bbpress root — should it be in bb-templates instead (why have two templates folders?)?
Sorry, I think I’m dense. Hope you can help. Thanks in advance.
Delete my last comment. I got it by putting a copy of default style in the folder. Now I just have to fix the middle part.
Author Edit: I’ll keep them here for anyone else having the same problem. thanks.
I followed all your steps and am able to get the header, sidebar to load. However, all the rest of the bb press styling for the other areas being displayed such as discussion, forums(all out of wack no styling). Any idea how to fix it to maintain its styling and fit within the prescribed area.
I have a few ideas on how to fix this, but i really don’t have a clue what I’m doing;-). Would really appreciate some help and guidance.
1. Go in and change the code on header, footer, and css file in bbpress to mimic my wordpress theme. I want to avoid having to go in and work that whole mess out.
2. Since I am having the header, footer, and sidebar called up from wordpress, the bbpress css file isn’t successfully being called up. Is there a way to call up the bbpress CSS file? So it could load, WP Header, WP Sidebar, bbpress css formating, WP footer?
3. While I wait I’m going to attempt to add the bbpress CSS that is being called up to the WP CSS to see if that works.
Thanks,
Matt
Yup! you are absolutely right.
I have been meaning to fix that thing since ice age. but haven’t got to it.
here are the replies.
1. will work but is not recommended because the next time you wish to change the theme in wordpress, bbpress will be off its rockers again.
2. There are hooks that can do it. But it will be a while before i can write up a code for it.
3. yes. Easy solution. Take the code for stylesheet of bbress and add it to the wordpress header.php. Everything will fall in place.
Let us know how it goes! Cheers
Well I went with option 3. Instead of placing the CSS in the header.php I placed in in the style.css file of my theme. Having two problem:
1. Do not know the CSS command or which attribute to add it to, to make the posts under the title, instead of occuring after the sidebar content. ex:http://mysoberlife.com/forums/topic.php?id=3&page&replies=1
2. In internet explorer my sidebar loads in the forum area when I am logged in. I have a loop in the sidebar to show different content when a user is logged in or logged out. I messed around with the sidebar code but that made no difference. I have no idea whats going on. Any idea why it would be loading everything from livesupport down into the main forum area?
Hope all of that made sense
Thanks for the help!!
-Matt
Excellent plugin.
I did have trouble trying to active the new theme, but simply uploading a copy of kakumei’s screenshot.png solved the issue.
Maybe it should come pre-packaged with a screenshot!
Although I find it really silly, that you can’t active it without one >
Can I just have the template share between wordpress and bbpress … I don’t want the users of the forums to be able to login to wordpress?
I would think so.. just use the template and dont make changes to the bbpress config file and stuff.. that should do it.
I’m so sorry, but can anyone rewrite it all again step by step or integrate the full php codes for each modified file.
Hey Muh’d
I’ve been meaning to rewrite this for a long time now.. specially because there have been so many releases after this one. Will do it soon..