Now we need to put together a correct mysql query.
Let’s try something simple.
SELECT * FROM bb_topics WHERE topic_status=0 ORDER BY topic_time DESC LIMIT 10
SELECT means “grab the following”
the asterisk means “all the fields in the table”
FROM bb_topics is kinda obvious, it’s the table we want
topic_status=0 means it’s topics not deleted
ORDER BY topic_time DESC means put the newest topics on top
LIMIT 10 means we want only the first 10
Let’s say we also wanted to exclude topics that were closed, since people can’t reply, we don’t want to tease them. In that case you would change the
WHERE topic_status=0
to
WHERE topic_status=0 AND topic_open=1
or let’s say you only wanted “stickies”
WHERE topic_status=0 AND topic_sticky!=0
Okay now to use that in WordPress we do the following:
global $wpdb;
$query="SELECT * FROM bb_topics WHERE topic_status=0 ORDER BY topic_time DESC LIMIT 10";
$results=$wpdb->get_results($query);
If all goes well, WordPress will then execute the query and then fill $results
with the answers.
Now comes the output part.
Both bbPress and WordPress have a very simple way of fetching data.
WordPress uses $wpdb
bbPress uses $bbdb
(the db part means database, very simple)
Then there’s the good old “get_results”. They both use that.
bbpress:
$results=$bbdb->get_results("mysql query goes here");
wordpress:
$results=$wpdb->get_results("mysql query goes here");
Many times you can use the same query in either bbpress or wordpress by just changing $bbdb to $wpdb or visa-versa.
Then you have to figure out what you are asking for.
Let’s use the really simple bbPress Topics table as an example. Unless you’ve customized your install, the Topics table is probably called bb_topics
Here are all the fields available inside of bb_topics
.
topic_id
topic_title
topic_slug
topic_poster
topic_poster_name
topic_last_poster
topic_last_poster_name
topic_start_time
topic_time
forum_id
topic_status
topic_open
topic_last_post_id
topic_sticky
topic_posts
tag_count
I’m not sure if this has been addressed elsewhere already or a plugin already exists but for novices that have even just a beginner’s knowledge of how php+mysql works I want to show you how easy it is to show bbPress info inside of WordPress and vise-versa.
You should NOT be using overly complex plugins like bbPress-Live or parsing RSS feeds if you have WordPress and bbPress sharing the same database but different tables. Instead, it’s a piece-of-cake to grab info from each other directly and display it. You don’t even need a plugin, you can code it right into your templates (as long as you know they will remain working together).
So I’ll give some examples here and then if anyone has questions feel free to ask.
You shouldn’t need a RewriteCond in that case, the RewriteRule can work without it if it’s simple enough.
If you are using the .htaccess inside of the /forum/ directory though, the above examples need to be trimmed without the forum/ part.
ie.
RewriteRule ^forum/faq
should actually be
RewriteRule ^faq
Only leave the forum/
part in there if you are using the .htaccess in the parent (webroot) folder.
To get bbPress you work you might be able to go into bb_config.php
and edit this line
$bb_table_prefix = 'bb_';
and make it say
$bb_table_prefix = '';
(that’s just two single quotes together with no space)
Not sure if it would work and it’s bad idea to keep running like that.
Using phpMyAdmin, you could try to rename all the tables to bb_users, bb_usermeta, etc.
But do you see your WordPress tables? You have a bigger problem is there’s wp_users and wp_usermeta and then you don’t see topics forums posts tables.
You may have installed bbpress into a new database instead of the old wp database?
Copy all the names of the tables in the left hand site of phpmyadmin here so we can see better what’s wrong.
It looks like you have an extra db in there. So if your database is database, your tables are actually named database.dbusers, for example?
The default would be database.bb_users.
To change the table prefix your bbPress installation uses, there is a value in bb-config.php called $bb_table_prefix which is normally set to “bb_”. What is the value in your file?
To recover, you might want to rename all your tables using a prefix, then add that prefix to bb-config.php for $bb_table_prefix
. I think that would work.
I think leaving the tables with no prefixes is a bad idea, because if you install other software in the same database, you might have a conflict with similarly named tables. Not every application behaves well and allows a table prefix. oscommerce used to do that (no table prefix, just tables with normal names that would step all over any existing similarly named tables.)
I just thought to check the address bar to see if the proper reply number is being appended, and it is. So, the URL looks like:
https://bbpress.org/forums/topic/column-widths-topic-posts-last-poster-freshness?replies=2#post-21105
But there is no #post-21105 (my reply) on the page. It’s just not there yet. Odd.
You didn’t mention the version you’re using, but in Alpha 2, they’re not set. They are just table cells with no width. The will resize the fit the data. If you want to set them, for the front page anyway, the tables are generated in front-page.php. Just look for all the <td>
with no widths and adjust yours there.
Just a question:
do you include your wp functions in bbpress? I see calls to wp functions in several bb functions (also in bb_insert_topic and bb_insert_post) and I can imagine that if you dont include wp functions in bbpress, that these statements fail.
I cannot include wp functions with the
$bb->WP_BB = true;
if (file_exists('../wp-blog-header.php'))
require_once('../wp-blog-header.php');
else
if (file_exists('../../wp-blog-header.php'))
require_once('../../wp-blog-header.php');
part because then my forums don’t work. I can’t access my bb-admin pages and bbpress doesn’t recognize my users.
What breaks it is the inclusion of the wordpress functions in the bb-config.php file. If you delete that code and visit the admin, it will work just fine.
I decided to give the bbPress plugin another chance. I installed it and tried creating a new topic… the browser was thinking for a looong time. I eventually stopped the process, deactivated the plugin, and created a new topic — that one was created very quickly.
It could be an issue with the permissions of my sitemap.xml, although I am pretty sure I 777’d it properly.
As for size of the forum, it’s significant but not huge. Thanks to ck’s awesome Mini Stats plugin, I can give you the exact stats: ~11k Topics and ~75k posts.
Just thought I’d share an update.
You probably have the path to the wp-blog-header.php wrong. You can try the full path there in the bb-config.php or you can verify that the relative path is actually correct. You may need to do something like ../wordpress/wp-blog-header.php
if your WordPress installation is in a folder on the same level as bbpress. It’s easy to figure out if you have a command line. If not, if you can describe your directory structure, someone can help you with the path to wp-blog-header.php.
That’s really interesting and definitely would be really annoying.
There’s never been an official mechanism to change slugs in bbPress but it should not touch them during upgrades.
I have to assume there was a bug in 0.8.3 where it would create bad or invalid slugs and that was some kind of attempt to fix the issue in the newer 0.9 code.
Be sure to note this in TRAC, otherwise it might not be seen by the developers.
The core developers absolutely refuse to ship bbPress with pre-made /my-plugins
and /my-templates
directory for reasons I cannot fathom. It’s very weird, especially since documentation to create it is very sparse and they will still work if you put items incorrectly into the bb-
directories.
Error says line 657 and 680
but what you have to fix is on lines 652 and 675
Burt above gave the fix here it is in full so you can just cut and paste into those lines:
'<img src="%1$ssupport-forum-%2$s.png" alt="[%3$s]" title="[%3$s]" style="vertical-align:top; margin-right:0.3em; width:14px; height:14px; border-width:0;" />%4$s',
Same code goes in both lines.
THANKS to Burt for providing the fix!!!
Keep in mind I’m an independent plugin developer and not directly associated with bbPress.org or Automattic.com
I just moderate here to help out. bbPress.org is part of Automattic.com and doesn’t actually need donations of money, Sam and Michael are paid employees.
But code contributions are tremendously appreciated. A quality bug report or code contribution on http://trac.bbpress.org goes a long way to helping bbPress.
(If you’d like to donate to me specifically for my plugin development, you can help me towards a replacement monitor here.)
I recently upgraded my old 0.8.3.1 bbPress to version 0.9.0.2. For the most part, the upgrade went great!
However, during the upgrade, all forum slugs were “recalculated”, so if I had manually edited my forum slugs, they were overwritten.
By way of example, say I ran this forum and I created a forum named “Super Troubleshooting”. If I had activated pretty permalinks, the URL for this forum would be: http://bbpress.org/forums/forum/super-troubleshooting.
Then, say I manually went in and changed the “forum slug” to be “superdupertroubleshooting” (for SEO reasons). So now the URL for that forum would be: http://bbpress.org/forums/forum/superdupertroubleshooting.
When I upgraded from 0.8.3.1 to 0.9.0.1, the upgrade function “recalculated” the forum slug using the forum title. In our example, this would change the URL from http://bbpress.org/forums/forum/superdupertroubleshooting to http://bbpress.org/forums/forum/super-troubleshooting.
I looked in the code, and this is all controlled by function bb_upgrade_process_all_slugs() in /bb-admin/upgrade-functions.php. Reading the code, it seems like the code also “recalculates” slugs for topics too!
“Recalculating” the slugs for all forums and topics seems like an odd design decision to me, because it changes URLs so the webmaster loses Google juice. I was going to create a ticket in Trac, but maybe I’m missing something. Is there a good reason to “recalculate” slugs when upgrading a bbPress installation?
I reformatted the code so it looks pretty:
<object width="120" height="240">
<param name="movie" value="http://widget.chipin.com/widget/id/c7cf54857a3ba44d" />
</param>
<param name="allowScriptAccess" value="always" />
</param>
<param name="wmode" value="transparent" />
</param>
<param name="event_title" value="Help%20bbPress" />
</param>
<param name="event_desc" value="bbPress.org%20is%20powered%20by%20the%20same%20poeple%20that%20power%20WordPress.%20The%20forum%20you%20see%20here%20is%20powered%20by%20bbPress.%20They%20need%20your%20help%2C%20please%20give%21" />
</param>
<embed src="http://widget.chipin.com/widget/id/c7cf54857a3ba44d" flashVars="event_title=Help%20bbPress&event_desc=bbPress.org%20is%20powered%20by%20the%20same%20poeple%20that%20power%20WordPress.%20The%20forum%20you%20see%20here%20is%20powered%20by%20bbPress.%20They%20need%20your%20help%2C%20please%20give%21" type="application/x-shockwave-flash" allowscriptaccess="always" wmode="transparent" width="120" height="240"></embed>
</object>
I am a budding new Internet Marketer and I have no money.
But that doesn’t mean I can’t help… My forum is just in it’s infancy but you can see how I am helping bbPress.org round up some money to continue it’s work.
http://forums.seocoalition.com
I have included in the left hand side a ChipIn.com widget. I will try to raise $500 dollars for bbPress.org and see if we can get _ck_ some extra cash to keep the process going.
I don’t know if this is going to work but I am willing to try. I think that anyone using this free product should give something back.
I am putting the code for the widget below and you can use it on your sites or what have you to help out. If you need different sizes, let me know and I will see what I can do.
<object width="120" height="240"><param name="movie" value="http://widget.chipin.com/widget/id/c7cf54857a3ba44d"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><param name="event_title" value="Help%20bbPress"></param><param name="event_desc" value="bbPress.org%20is%20powered%20by%20the%20same%20poeple%20that%20power%20WordPress.%20The%20forum%20you%20see%20here%20is%20powered%20by%20bbPress.%20They%20need%20your%20help%2C%20please%20give%21"></param><embed src="http://widget.chipin.com/widget/id/c7cf54857a3ba44d" flashVars="event_title=Help%20bbPress&event_desc=bbPress.org%20is%20powered%20by%20the%20same%20poeple%20that%20power%20WordPress.%20The%20forum%20you%20see%20here%20is%20powered%20by%20bbPress.%20They%20need%20your%20help%2C%20please%20give%21" type="application/x-shockwave-flash" allowScriptAccess="always" wmode="transparent" width="120" height="240"></embed></object>
Alternatively if you don’t trust me, go to ChipIn.com and create your own widget to help out the cause!
You need to create the folder
You’ll have these folders on the root of your forums:
/bb-admin/
/bb-cache/
/bb-includes/
/bb-plugins/
/bb-templates/
/my-plugins/
/my-templates/
mzimmers, point your BROWSER (not an FTP) to yourdomain.com/wp-admin/options.php
Like mine is http://jorjafox.net/blog/wp-admin/options.php
And it is documented where these are on the WordPress Side, which is how I knew
If I add
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
to my wp-config file, I can’t log in at all. But other than that, yes. Those directions are mostly the same as these, except for the sitecookie hack.
Go to yourdomain.com/wp-admin/options.php and look for auth_salt and logged_in_salt.
Add these to your BB Config:
define('AUTH_SALT', 'VALUE');
define('LOGGED_IN_SALT', 'VALUE');
Any clue on what the RewriteCond code for this would be? I’ve been trying to look this up but haven’t found anything yet.
Admittedly, I couldn’t get BBPress-Live to work (I wanted to include recent forum posts on my WP front page), but I figured it may be worth a shot
Good luck!